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