TextBox Control
The TextBox control can be used for both user input and read-only text display. You can configure it to be single line or multiline or to accept passwords. If you set it to multiline, it automatically wraps unless the Wrap property is set to false. The text it contains can exceed the length of the control displayed on the page. The TextBox, DropDownList, Label, and other text-friendly controls implement the ITextControl interface, which is new to Version 2.0 of ASP.NET. This interface has a single property, Text, which is the visual content of the control.
Table 4-2 lists many of the common properties specific to the TextBox control. If any of these attributes are omitted from the control, then the default value will apply.
Table 4-2. Some properties specific to the TextBox control
|
Name |
Type |
Get |
Set |
Values |
Description |
|---|---|---|---|---|---|
|
|
Boolean |
✗ |
✗ |
|
Determines if automatic postback to server will occur if user changes contents of control. If |
|
|
Int32 |
✗ |
✗ |
|
Width of the text box in characters. Default is |
|
|
Int32 |
✗ |
✗ |
|
Maximum number of characters allowed. If |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access