Thursday, 15 August 2013

what is hidden field control in asp.net

Hidden field is a control which is used to store small amounts of data on the client.
It store one value for the variable and it is a preferable way when a variable's value is changed frequently. Hidden field control is not rendered to the client (browser) and it is invisible on the browser.
A hidden field was stored in client side and we can change the runtime value change of hidden filed.

See the simple example how to use a hidden field.

to write in aspx file:
<asp:HiddenField ID="HiddenField1" runat="server"  />  
 
to write in .cs file
if (HiddenField1.Value != null)
   {
    int val= Convert.ToInt32(HiddenField1.Value) + 1;
    HiddenField1.Value = val.ToString();
    Label1.Text = val.ToString();
   }

1 comments :

  1. Nice article you have been posted, It's very informative and helpful. Thanks for sharing it.clickperfect

    ReplyDelete