ASP.NET TextBox MaxLengthProperty
TextBox Control
Definition and Usage
The MaxLength property is used to set or return the maximum number of characters allowed in a TextBox control.
Syntax
<asp:TextBox MaxLength="num" runat="server" />
| Property | Description |
|---|---|
| num | A value that specifies the maximum number of characters allowed in the text box. |
Example
The following example sets the maximum number of characters allowed in the TextBox control:
<form runat="server">
<asp:TextBox id="tb1" runat="server" MaxLength="10" />
</form>
<asp:TextBox id="tb1" runat="server" MaxLength="10" />
</form>
Demo Example »
TextBox Control Other Extensions