Click here to Skip to main content
14,976,314 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:

In my requirement, user can specify the phone number between 9 digits to 14 digits. How can I achieve this in with any one of the available validators.
Thanks7872 3-Oct-13 2:27am
srmohanr 3-Oct-13 2:29am
Thanks7872 3-Oct-13 2:31am
What you mean? If you do a simple google search you will find tons of links related to this.You just need to verify the length of the entered number.

You can use Length validator or regular expression validator In
You can use something as below:

<asp:textbox id="TextBox1" runat="server"></asp:textbox>
<asp:regularexpressionvalidator id="rgvPhoneNumber" controltovalidate="TextBox1" runat="server" validationexpression="^[0-9]{9,14}$" errormessage="Please enter a phone number between 9 and 14 digits">

srmohanr 3-Oct-13 2:46am
Thanks. Its working fine now. Can you please tell me how to add +15 as country code between the phone number..
Anurag Sinha V 3-Oct-13 4:27am

try the above link

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