RegisterHiddenField
does not generate a server-side control; it simply creates a basic
<input type="hidden" name="myhiddenField">
Page.FindControl("myhiddenField")
will not locate anything on the server side, and even
document.getElementById("myhiddenField")
will not return anything on the client side since only the name and not the id is specified.
Therefore, if you need to access it on the server side, it is advisable to use a HiddenField
server control or at least utilize an html-input
with the attributes type=hidden
and runat="server"
.