Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 656
  • Last Modified:

Mask Edit box in asp.net

I have a text box and need the user to enter in a time.  Is there a way to make a text box only allow a certain formate.  I need the date to be entered with the : in it.  An example is 9:58.  How can I check it is a number and that they enter in :.

Thanks
0
running32
Asked:
running32
  • 2
  • 2
1 Solution
 
daniel_ballaCommented:
Hi running32,
you can check it with a RegularExpressionValidator, with an expression such as ^\d{2}\:\d{2}$

Cheers!
0
 
kaliyugkaarjunCommented:
0
 
daniel_ballaCommented:
just a quick correction, better use the expression  ^\d{1,2}\:\d{1,2}$  as this will allow single digits too.

Cheers
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now