views:

70

answers:

1

Hello all,

I have using c#.net.

I have a textbox which should contain a time. It needs to be in 24 hour format.

I would like to use a CustomValidator but can’t find anything on the net.

Thanks in advance for any help

Clare

+1  A: 

For using CustomValidator check this link, but I prefer regular expression validator instead.

Check this question about validation of time with Regular Expression Validator :

Regular expression to validate valid time

Canavar
I have added the RegularExpressionValidator (RegEx taken from the other post). However even though the time is incorrect it still allows me to update (update button) do I need to do client side validation?
ClareBear
If you would like to block the user from saving the form after inputting an incorrect time then you'll need at least server side validation- and client-side validation isn't a bad idea either. Can you post your code in the original question?
Nathan Taylor