Home DotNet How to Validate Time Entry with hhmm Format in ASP.NET
Author:

To validate a time entry with a hhmm format you will need to use regular expression. Here's how:

1. Add a text box to the page.

<asp:TextBox ID="txtTimeEntry" width="40px" maxlength="4" runat="server" />

2. Then next add a RegularExpressionValidator control to the page.

Put in all the requirement informations such as ControlToValidate, ErrorMessage, runat and ValidationExpression.

3. Ensure the validation expression string is similar to the below.

ValidationExpression="^([0-1][0-9]|[2][0-3])([0-4][0-9])$"



Comments (0)
Write comment
Your Contact Details:
Comment:
Security
Please input the anti-spam code that you can read in the image.

"