The TextBox control can be used to display three different types of input fields depending on the value of its TextMode property. The TextMode property accepts the following three values:
-
SingleLine Displays a single-line input field.
-
MultiLine Displays a multi-line input field.
-
Password Displays a single-line input field in which the text is hidden.
You can use the following properties to control the rendering characteristics of the TextBox control (this is not a complete list):
-
AccessKey Enables you to specify a key that navigates to the TextBox control.
-
AutoCompleteType Enables you to associate an AutoComplete class with the TextBox control.
-
AutoPostBack Enables you to post the form containing the TextBox back to the server automatically when the contents of the TextBox is changed.
-
Columns Enables you to specify the number of columns to display.
-
Enabled Enables you to disable the text box.
-
MaxLength Enables you to specify the maximum length of data that a user can enter in a text box (does not work when TextMode is set to Multiline).
-
ReadOnly Enables you to prevent users from changing the text in a text box.
-
Rows Enables you to specify the number of rows to display.
-
TabIndex Enables you to specify the tab order of the text box.
-
Wrap Enables you to specify whether text word-wraps when the TextMode is set to Multiline.
The TextBox control also supports the following method:
And, the TextBox control supports the following event:
When the AutoPostBack property has the value true, the form containing the TextBox is automatically posted back to the server when the contents of the TextBox changes.