ASP.NET TextBoxControl


Web Server ControlsWeb Server Control

Definition and Usage

The TextBox control is used to create a text box where the user can input text.


Properties

Property Description .NET
AutoCompleteType Specifies the AutoComplete behavior of the TextBox control. 2.0
AutoPostBack Boolean value that specifies whether the control automatically posts back to the server when the content changes. The default is false. 1.0
CausesValidation Specifies whether the page is validated when a Postback occurs. 2.0
Columns The width of the textbox. 1.0
MaxLength The maximum number of characters allowed in the textbox. 1.0
ReadOnly Specifies whether the text in the text box can be changed. 1.0
Rows The height of the textbox (only used when TextMode="Multiline"). 1.0
runat Specifies whether the control is a server control. Must be set to "server".
TagKey
Text The content of the textbox. 1.0
TextMode Specifies the behavior mode of the TextBox (single-line, multiline, or password). 1.0
ValidationGroup The group of controls to be validated when a Postback occurs.
Wrap Boolean value indicating whether the content of the textbox wraps. 1.0
OnTextChanged The name of the function that is executed when the text in the textbox is changed.

Web Control Standard Attributes

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth, CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled, SkinID, Style, TabIndex, ToolTip, Width

For a complete description, please visitWeb Control Standard Attributes。

Control Standard Attributes

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible

For a complete description, please visitControl Standard Attributes。


Examples

Textbox
In this example, we declare a TextBox control, a Button control, and a Label control in the .aspx file. When the submit button is triggered, the submit subroutine is executed. This submit subroutine outputs text to the Label control.

Textbox 2
In this example, we declare a TextBox control, a Button control, and a Label control in the .aspx file. When the submit button is triggered, the submit subroutine is executed. This submit subroutine copies the content of the text box to the Label control.


Web Server ControlsWeb Server Control Other Extensions