How to allow only 5 digit numeric value in Textbox using Regular Expression Validator control?

 Posted by Rajesh_Kumar on 1/21/2014 | Category: C# Interview questions | Views: 3635 | Points: 40
Answer:

We will write below code in RegularExpressionValidator control to achieve.

<asp:TextBox runat="server" id="txt_version" />

<asp:RegularExpressionValidator runat="server" id="rex_version" ControlToValidate="txt_version" ValidationExpression="^[0-9]{5}$" ErrorMessage="Only Numeric values allowed" />


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response