Culture Problem

Apr 29, 2009 at 6:22 AM
Edited Apr 29, 2009 at 6:31 AM


I am from Brazil and I am getting an error with the latitude and longitude number of the dinner model.

When creating a new dinner, the ModelState.IsValid is always false because of 2 errors that happens when trying to convert a string into a double.

The problem is that the my culture is set to pt-BR., so, the decimal separator is (,) and group separator is (.).
I couldn´t find where there is the conversion of the latitude and longitude into double values, so I could fix the number format.

When the culture is set to en-us then the page works fine.

Here are more details about the error:
Excetion = "The parameter conversion from type 'System.String' to type 'System.Double' failed. See the inner exception for more information."

Inner Exception= "-15.769999623298645 is not a valid Double"


inSystem.Web.Mvc.ValueProviderResult.ConvertSimpleType(CultureInfo culture, Object value, Type destinationType)
in System.Web.Mvc.ValueProviderResult.UnwrapPossibleArrayType(CultureInfo culture, Object value, Type destinationType)
in System.Web.Mvc.ValueProviderResult.ConvertTo(Type type, CultureInfo culture)
in System.Web.Mvc.DefaultModelBinder.ConvertProviderResult(ModelStateDictionary modelState, String modelStateKey, ValueProviderResult valueProviderResult, Type destinationType)

"Does any one knows how to fix it?

Sorry, I didn´t see the other post about it (