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).
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).
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!