tags:

views:

60

answers:

2

Possible Duplicate:
How do I create a regular expression to accept not more than 10 digits?

I want a regular expression which will allow up to 10 digits in a user control having a text box. (ASP.net 3.5).

+1  A: 

Add regular expression validator with your textbox:

<asp:TextBox ID="tb" runat="server" MaxLength="10" />
<asp:RegularExpressionValidator ID="rvDigits" runat="server" 
   ControlToValidate="tb"  Text="*" Display="Dynamic" 
      ValidationExpression="^\d{0,10}$" />

A better approach will be to use jQuery and jquery.numeric plugin!

TheVillageIdiot
A: 

^[0-9]{1,10}$ or ^\d{0,10}$

Rashmi Pandit