HiddenField Class
Assembly: System.Web (in system.web.dll)
[ControlValuePropertyAttribute(L"Value")] public ref class HiddenField : public Control, IPostBackDataHandler
/** @attribute ControlValuePropertyAttribute("Value") */
public class HiddenField extends Control implements IPostBackDataHandler
ControlValuePropertyAttribute("Value") public class HiddenField extends Control implements IPostBackDataHandler
Not applicable.
The HiddenField control is used to store a value that needs to be persisted across posts to the server. It is rendered as an <input type= "hidden"/> element.
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.
To specify the value for a HiddenField control, use the Value property. You can provide a routine that gets called every time the value of the HiddenField control changes between posts to the server by creating an event handler for the ValueChanged event.
The following example demonstrates how to use the HiddenField control to store the value of a TextBox control between posts to the server.
Security Note: |
|---|
| This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview (Visual Studio). |
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand. Permission value: Minimal.
- AspNetHostingPermission for operating in a hosted environment. Demand value: InheritanceDemand. Permission value: Minimal.
Security Note: