Checking character/string length using .net validators

Filed in .Net | Javascript Leave a comment

I need to check character length between 9 to 24 need to be all numbers. I have applied below regular expression validator.

<asp:RegularExpressionValidator ID=”revBankAccountNo” runat=”server”┬áControlToValidate=”txtBankAccountNo” Display=”Dynamic” SetFocusOnError=”True”┬áValidationExpression=”^[0-9]{4,24}$”>*</asp:RegularExpressionValidator>

I need to check character length to be exact 9. I have applied below regular expression validator.

<asp:RegularExpressionValidator ID=”revBankAccountNo” runat=”server”┬áControlToValidate=”txtBankAccountNo” Display=”Dynamic” SetFocusOnError=”True”┬áValidationExpression=”^[0-9]{9}$”>*</asp:RegularExpressionValidator>

TOP