我如何限制文本框只接受数字&长度达10 [英] How do i restrict textbox accept only numerics & length upto 10
本文介绍了我如何限制文本框只接受数字&长度达10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何限制文本框只接受数字和长度达10
How do i restrict textbox accept only numerics & length upto 10
推荐答案
你可以试试这个
Hi,
you can try this
<asp:TextBox ID="TextBox1" MaxLength="10" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="TextBox1"
ValidationExpression="^(0|[1-9][0-9]*)
runat = 服务器 ErrorMessage = 请仅输入数字
< span class =code-attribute> ForeColor = 红色 > < / asp:Regu larExpressionValidator >
" runat="server" ErrorMessage="Please Enter Only Numerics" ForeColor="Red"></asp:RegularExpressionValidator>
这篇关于我如何限制文本框只接受数字&长度达10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文