Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Use validator to validate date in distinct countries (http://www.velocityreviews.com/forums/t91137-use-validator-to-validate-date-in-distinct-countries.html)

Fernando Lopes 11-19-2004 12:03 PM

Use validator to validate date in distinct countries
 
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



=?Utf-8?B?TWlrZUw=?= 11-19-2004 01:05 PM

RE: Use validator to validate date in distinct countries
 
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
>
>
>


Peter Blum 11-19-2004 07:45 PM

Re: Use validator to validate date in distinct countries
 
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: PLBlum@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"MikeL" <MikeL@discussions.microsoft.com> wrote in message
news:9EDB4EBF-84BA-495D-94C9-8BC1AAE92344@microsoft.com...
>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
>>
>>
>>





All times are GMT. The time now is 10:14 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.