This project is read-only.

numeric validation and localisation

Jul 16, 2012 at 9:17 AM

Validation of the decimal Album.Price works fine as long as my Windows Regional language settings is English. In Dutch it becomes impossible to pass validation because the decimal seperator is a comma in stead of a dot. The UI displays decimal numbers correctly with the comma as dec. seperator, but validation fails. Even if I try entering a number with a dot as decimal seperator validation fails.

I tried setting Windows Regional settings to English and then forced the current culture to dutch by adding the following to global.asax:

       protected void Session_Start()
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("nl-NL");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("nl-NL");

Now I would expect decimal numbers in the UI  to be formatted according to Dutch rules but that does not work either.

Is there a solution for this issue? If not, MVC out of the box is completely useless for many non-english users...