asp.net中的验证 [英] validations in asp.net
本文介绍了asp.net中的验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个用于手机号码的文本框,我想对其进行验证,因为它只能接受10位数字的手机号码且不包含字母.
请尽快答复.
I have a text box for mobile no.I want to validate it as it can accept only 10 digit mobile no and no alphabets.
please reply soon.
推荐答案
您的问题的解决方案:
Solution to ur prob:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Please enter valid Mobile number!"
ValidationExpression="^([7-9]{1})([0-9]{9})
" < >
标记它是否有帮助.........
mark it if it helps.........
Regex.IsMatch("Your Mobile number", @"^[0-9]{10}+
这篇关于asp.net中的验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文