Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

HiddenField

0.00/5 (No votes)
6 Aug 2009 1  
This control enables a developer to store a non-displayed value in the rendered HTML of the page. The HiddenField control is used to store a value

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

This control enables a developer to store a non-displayed value in the rendered HTML of the page. The HiddenField control is used to store a value that needs to be persisted across multiple postbacks to the server.

It is rendered as an <input type= "hidden"/> element. This control was introduced by ASP.NET 2.0.

Normally view state, session state, and cookies are used to maintain the state of a Web Forms page. However, if these methods are disabled or are not available, you can use the HiddenField control to store state values. Note that because the value of a HiddenField is rendered to the client browser, it is not suitable for storing security-sensitive values. To specify the value for HiddenField a control, use the Value property. You can provide a routine that gets called everytime the value of the HiddenField control changes between postbacks to the server by creating an event-handler for the ValueChanged event. Hidden field is also used many a times when we need to work with a value in both server side and client side.

Note:   In order to use HiddenField ou've to use HTTP-Post method to post web page. Unlike to its name, its value is not hidden.

Whitepapers/Blogs

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here