Allowing Minimum of 5 and Maximum of 7 letters on a Textbox?

vishalneeraj-24503
Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 488
Sometimes,we require to allow Textbox to validate Minimum 5 and Maximum 7 characters. So, here,we will use Asp.net Regular Expression Validator control to validate:-
<asp:TextBox Id = "txt_employee_code" runat = "server"></asp:TextBox>
<asp:RegularExpressionValidator Display = "Dynamic"
ControlToValidate = "txt_employee_code"
Id = "reg_ex_employee_code" ValidationExpression = "^[\s\S]{5,7}$"
runat = "server" ErrorMessage =
"Minimum of 5 and Maximum of 7 letters allowed only">
</asp:RegularExpressionValidator>

Comments or Responses

Login to post response