ASP.NET HtmlInputText Control

Definition and Usage

The HtmlInputText control is used to control <input type="text"> and <input type="password"> elements. In HTML, these elements are used to create text fields and password fields.

Properties

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 element.
MaxLength The maximum number of allowable characters in the element.
Name The name of the element.
runat Must be set to "server" as it defines the control as a server control.
Size The width of the element.
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.

Example

HTMLInputText
In this example, we declare 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 write a welcome message to the p element.