ASP.NET TextBox Control
Web Server Controls
Definition and Usage
The TextBox control is used to create a text box where users can enter text.
property
| property | Description | .NET |
|---|---|---|
| AutoCompleteType | Specifies the AutoComplete behavior of the TextBox control. | 2.0 |
| AutoPostBack | A Boolean value that specifies whether the control automatically posts back to the server when its 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 (used only 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, multi-line, or password). | 1.0 |
| ValidationGroup | The control group validated when a postback occurs. | |
| Wrap | A Boolean value that indicates 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。
Web Control Standard Properties
AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible
For a complete description, please visit Web Control 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 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 text box content to the Label control.
Web Server Controls