Validating date in textbox in asp net
Regular expressions that are already shown here will help you on the client side but you also need to validate these on the server side.
Parse Exact because second one will throw exception if something is not ok.
I'm using a comparevalidator where operator is set Data Type Check.
Work fine but when the date entered is mm/dd/yy nothing seems to happen (no events fired, no error message, page just remains the same). thx In fact, when you use Compare Validator control to validate date type.
If there is nothing assigned, the validator will show nothing.
Make sure the Validation Group property is the same value. Is Valid is true within the Click event handler prior to saving/using the page data.
I'm using a popup calendar (AJAX Control Toolkit Extender) to allow a date to be picked for a Text Box. You will have to use some client side validaion technique.
beside the mm/dd/yy case, validation works normally..summary is outside.If I enter 1 January 1000 as the min or max value I get an error saying value cannot be converted to type date, but if I use another format it picks up my entered text as invalid.Below is my code: I believe that the dates have to be specified in the current culture of the application.You might want to experiment with setting Culture Invariant Values to true and see if that solves your problem.Otherwise you may need to change the Date Time Format for the current culture (or the culture itself) to get what you want.