Culture and validators

  • Thread starter Thread starter Bogdan POPESCU
  • Start date Start date
B

Bogdan POPESCU

Hi, folks!

I am currently working on a multilanguage application in ASP.NET and I have
the following problem: we need to use the French date format (dd/mm/yyyy),
but the point (.) as a decimal separator, instead of the comma (,) which is
the default decimal separator for the French culture.
Is there any way to do this when using the .NET Framework RangeValidator of
data type Double?

Thanks,
Bogdan
 
Hi,

Create a specific culture setting the needed format and
then associate this culture with the current thread.

Here an example.

CultureInfo culture = (CultureInfo)
CultureInfo.InvariantCulture.Clone();
culture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
culture.NumberFormat.CurrencyDecimalSeparator = "." ;

Thread.CurrentThread.CurrentCulture = (CultureInfo)
Application["Culture"] ;

Hope this help you.
Ivan
 

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

Back
Top