Export (0) Print
Expand All

HiddenField

The HiddenField control provides you with a way to store information in the page without displaying it. For example, you might store a user-preference setting in a HiddenField control. For details about writing code for HiddenField controls, see HiddenField Class in the MSDN library Cc295019.xtlink_newWindow(en-us,Expression.40).png.

To add a HiddenField control to a page

  • Drag the HiddenField control from the Toolbox panel to your page.

NoteNote

Because there is no visual representation of a HiddenField control, you won't be able to see it in Design view, but you can see the control in Code view.

To put information into a HiddenField control, you set its Value property to the value you want to store between postbacks.

As with any other web server control, the information in a HiddenField control is available during postback. The information is not persisted outside the page.

HiddenField Control and Security

The information in a HiddenField control is not displayed when the browser renders the page, but users can see the contents of the control by viewing the page's source. Therefore, do not store sensitive information in a HiddenField control, such as user IDs, passwords, or credit card information.

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2014 Microsoft