Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Can you please tell me what is the use of htmlinputhidden in html server control in asp.net?
I mean in what way this control can be helpful in creating a web site
regards
shivani
Posted

 
Share this answer
 
Comments
shivani 2013 17-Jun-11 8:12am    
sir i have visited this site already but not able to locate its exact implementaion in making web site
Hidden Fields are used to store values. It is accessible through out the page.

We can store the value of any variable to the hidden field and then call them in any function in that page.

Eg:-
..Page_Load(){
int x=25;
HiddenField1.Value=x.ToString();
}

public void SomeFunction()
{
int y=Convert.ToInt(HiddenField1.Value);
}
 
Share this answer
 
Comments
BobJanova 17-Jun-11 11:17am    
While true, you could do that with an instance variable. The only purpose of a hidden field for data storage is if you also want to access it in client code.
Hidden fields are a way of passing information from one page to another, if the first page does a postback, or passing and retrieving information from client side (i.e. Javascript) code.

ASP.net handles most postback scenarios for you (by parking a stack of hidden fields on the page, incidentally), and postback-driven communication with client side scripts is considered to be poor user experience these days, so there is not much use for hidden fields in an average modern website.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900