Click here to Skip to main content
15,886,830 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to validate mobile number in asp.net??
Posted
Comments
CHill60 31-Mar-15 7:50am    
There are several ways. What have you already tried?
Sergey Alexandrovich Kryukov 31-Mar-15 7:53am    
It depends on other requirements, such as: are there '-' or other delimiters? what should be the format?
What have you tried so far?
—SA

Again, and again, I would ask my friend Google[^].
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 31-Mar-15 7:56am    
Fair enough, a 5.
My answer is just a step forward... :-)
—SA
 
Share this answer
 
Comments
CPallini 31-Mar-15 8:58am    
People are not willing to learn anymore...
Have my 5.
Sergey Alexandrovich Kryukov 31-Mar-15 9:35am    
Not willing? Do you mean the vote of 1 :-)
Thank you, Carlo.
—SA
Try this code:

XML
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br\>
    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
      ControlToValidate="TextBox1" ErrorMessage="RegularExpressionValidator"
    ValidationExpression="[0-9]{10}"></asp:RegularExpressionValidator>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900