HiddenField.Value Property
.NET Framework 2.0
Note: This property is new in the .NET Framework version 2.0.
Gets or sets the value of the hidden field.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
Use the Value property to specify or determine the value of the HiddenField control.
The following example demonstrates how to use the Value property to specify the value of the HiddenField control.
<%@ Page language="C#" %> <script runat="server"> void ValueHiddenField_ValueChanged (Object sender, EventArgs e) { // Display the value of the HiddenField control. Message.Text = "The value of the HiddenField control is " + ValueHiddenField.Value + "."; } </script> <html> <body> <form id="Form1" runat="server"> <h3>HiddenField Example</h3> Please enter a value and click the submit button.<br/> <asp:Textbox id="ValueTextBox" runat="server"/> <br/> <input type="submit" name="SubmitButton" value="Submit" onclick="PageLoad()" /> <br/> <asp:label id="Message" runat="server"/> <asp:hiddenfield id="ValueHiddenField" onvaluechanged="ValueHiddenField_ValueChanged" value="" runat="server"/> </form> </body> </html> <script language="javascript"> <!-- function PageLoad() { // Set the value of the HiddenField control with the // value from the TextBox. Form1.ValueHiddenField.value = Form1.ValueTextBox.value; } --> </script>
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.