Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all visitor.
I have created one textbox in ASP.NET.
i want to let user input only 5 chracters with format("A1937" or "B9487").
Note
the first character is start from ("A or Z") and 4 characters more is only number from ("0 to 9").

Is anyone know how to format like this?

Thanks
TONY
Posted

1 solution

The following code can be used for the above purpose

XML
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
    ControlToValidate="TextBox1"
    ErrorMessage="The text must be in the format A####";
    ValidationExpression="[A-Z]{1}[0-9]{4}">
</asp:RegularExpressionValidator>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900