Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Use validator to validate date in distinct countries

Reply
Thread Tools

Use validator to validate date in distinct countries

 
 
Fernando Lopes
Guest
Posts: n/a
 
      11-19-2004
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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlrZUw=?=
Guest
Posts: n/a
 
      11-19-2004
I believe this can be accomplished by change the localization of the thread.

Take a look at this article.

http://samples.gotdotnet.com/quickst...izingapps.aspx

I believe the validator will pickup on the culture change and validate
appropriately.

"Fernando Lopes" wrote:

> 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
>
>
>

 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      11-19-2004
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"MikeL" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I believe this can be accomplished by change the localization of the
>thread.
>
> Take a look at this article.
>
> http://samples.gotdotnet.com/quickst...izingapps.aspx
>
> I believe the validator will pickup on the culture change and validate
> appropriately.
>
> "Fernando Lopes" wrote:
>
>> 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
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
validate Date input using Custom Validator Grey ASP .Net 3 10-09-2012 06:11 AM
number of distinct elements in a const container and iterating over the distinct elements Hicham Mouline C++ 1 04-11-2010 10:56 AM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
compare validator to validate date in user control Shailesh Katti ASP .Net Web Controls 1 07-28-2003 11:20 AM
Struts Validator to validate *optional* date fields? Marcus Leon Java 1 06-30-2003 06:15 PM



Advertisments