I am using Page.ClientScript.RegisterHiddenField(“hf_Name”,value) in an ASP.net application, how to override or assign a new value to the same Hidden Field ‘hf_Name’ in code behind?
I am using Page.ClientScript.RegisterHiddenField(hf_Name,value) in an ASP.net application, how to override or assign a
Share
RegisterHiddenFielddoesn’t create a server side control, it justcreates a plain-old
<input type="hidden" name="myhiddenField">Page.FindControl("myhiddenField")will never find anything on serverside and evendocument.getElementById("myhiddenField")will return nothing on clientside since only the name and not the id is assigned.So if you need to access it on serverside, you should use a
HiddenFieldserver control or at least use ahtml-inputtype=hiddenwithrunat="server".