在文本框中添加正则表达式验证器:
<asp:TextBox ID="tb" runat="server" MaxLength="10" />
<asp:RegularExpressionValidator ID="rvDigits" runat="server"
ControlToValidate="tb" Text="*" Display="Dynamic"
ValidationExpression="^\d{0,10}$" />
Run Code Online (Sandbox Code Playgroud)
更好的方法是使用jQuery和jquery.numeric插件!
| 归档时间: |
|
| 查看次数: |
5204 次 |
| 最近记录: |