Friday, 13 February 2015

Hidden Field Management in ASP.NET

Hidden Field Management 

  • A hidden field is used for storing small amounts of data on the client side. In most simple words it's just a container of some objects but their result is not rendered on our web browser. It is invisible in the browser. 
  • It stores a value for the single variable and it is the preferable way when a variable's value is changed frequently but we don't need to keep track of that every time in our application or web program.
  • Hidden field are the controls provided by the ASP.NET and they let use store some information in them. 
  • The only constraint on hidden filed is that it will keep the information when HTTP post is being done, i.e., button clicks. It will not work with HTTP get.


EXAMPLE: 
1.     // Hidden Field  
2.       
3.     int newVal = Convert.ToInt32(HiddenField1.Value) + 1;  
4.     HiddenField1.Value = newVal.ToString();  
5.     Label2.Text = HiddenField1.Value; 

Points to Remember:
      Some features of hidden fields are:
  • Contains a small amount of memory
  • Direct functionality access

No comments:

Post a Comment