From MSDN library’s explanation, Page.RegisterHiddenField method allows server controls to automatically register a hidden field on the form. The field will be sent to the page when the HTML Form servers control is rendered.
This method takes 2 parameters:
hiddenFieldName – The unique name of the hidden field to be rendered
hiddenFieldInitialValue – The value to be emitted in the hidden form
Please take note that if you use this method twice with the same id with different value in your page, it will only register the first one.
For example:
Page.RegisterHiddenField(“field_1”, “value_1”);
Page.RegisterHiddenField(“field_1”, “value_2”);
Value_1 will be rendered while the second call is ignored.
On postback, you can use Request. Form(“field_1”) to get the data of the string result.
Cheers!
0 comments:
Post a Comment