ASP.NET HtmlInputHidden Control

Definition and Usage

The HtmlInputHidden control is used to control the <input type="hidden"> element. In HTML, this element is used to create a hidden input field.

Properties and Events

Properties Description
Attributes Returns all attribute names and value pairs of the element.
Disabled Boolean value indicating whether the control is disabled. The default is false.
id The unique id of the control.
Name The name of the element.
runat Specifies that the control is a server control. It must be set to "server".
Style Sets or returns the CSS properties applied to the control.
TagName Returns the tag name of the element.
Type The type of the element.
Value The value of the element.
Visible Boolean value indicating whether the control is visible.
Event Description
ServerChange When the content of the element is changed.

Example

HTMLInputHidden
In this example, we declare an HtmlInputHidden control, an HtmlInputText control, an HtmlInputButton control, and an HtmlGeneric control in the .aspx file. When the submit button is triggered, the submit subroutine will be executed. This submit subroutine will set the value of the hidden field to the value of the input field and display the value of the hidden field in the p element.