ASP.NET TextBox MaxLength property
Definition and Usage
MaxLength property sets or returns the maximum number of characters allowed in a TextBox control.
grammar
<asp:TextBox MaxLength="num" runat="server" />
属性 | 描述 |
---|---|
num | 数值,该值规定了文本框中所允许的最大字符数。 |
Examples
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>
The demonstration >>
TextBox controls