ASP.NET TextBox Control

Definition and Usage

The TextBox control is used to create a textbox that allows users to enter text.

Property

Property Description .NET
AutoCompleteType Specifies the AutoComplete behavior of the TextBox control. 2.0
AutoPostBack Boolean value specifying whether the content is posted back to the server when changed. The default is false. 1.0
CausesValidation Specifies whether the page is validated when 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 textbox can be changed. 1.0
Rows The height of the textbox (used only when TextMode="Multiline"). 1.0
runat Specifies whether the control is a server control. It 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 validated when Postback occurs.  
Wrap Boolean value indicating whether the content of the textbox wraps. 1.0
OnTextChanged The name of the function executed when the text in the textbox is changed.  

Web Control Standard Properties

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

For a complete description, please visit Web Control Standard Properties.

Control Standard Properties

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

For a complete description, please visitControl Standard Properties.

Example

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 will be executed. This submit subroutine will output 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 will be executed. This submit subroutine will copy the content of the text box to the Label control.