Use validator to validate date in distinct countries

F

Fernando Lopes

Hi.
How can i validate a date textbox using validator, but the validator need to
validate all data types, like:

USA: 11/19/2004
BRAZIL: 19/11/2004
GERMANY: 19.11.2004

So, in the validator message, i need to show how is the mask according the
country.
If my application is running in USA, and the user type 19/11/2004, the error
message will be:
Incorrect date. Please use this mask: MM/DD/YYYY, but if my application
running in Brazil, no error message will be raise.

I hope somebody understand me.

Thanks.

Fernando Lopes
 
P

Peter Blum

MikeL is correct that you need to set the CultureInfo on the current thread.
The only part missing is the validation:
Use a CompareValidator with its Operator=DataTypeCheck and Type="Date". It
respects the CultureInfo of the current thread.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top