Culture bug? Cannot create new dinner


When I create new dinner i always have ModelState.IsValid false. After put correct values on create page i have only red text "Please correct the errors and try again." and no errors belowe it. I chcecked deeper and the error is because in my culture double values are written with coma not dot and cast from string to double value cannot be done.
Closed Sep 26, 2013 at 5:11 PM by pmourfield


moosens wrote Apr 21, 2009 at 2:13 PM

I experience the same problem

fredgcosta wrote Apr 29, 2009 at 2:58 PM

I am from Brazil and I got the same problem.

wrote May 7, 2009 at 6:39 AM

Fixed on changeset 23425

Haacked wrote May 7, 2009 at 6:39 AM

Fixed in r23425

knipjo wrote Feb 10, 2010 at 4:44 PM

Hello, I may be wrong but this is still not working. the problem lies in the validation of the model when you try to edit or create a dinner. updatemodel does not pickup on longitude and latitude as they are using a coma...

I don't know how to solve this but here is how I made it work:
remove lat on lon from the bind list

public partial class Dinner
in // POST: /Dinners/Edit/2
update the model then insert the lat and lon values by hand

            cinema.Latitude = Double.Parse(Request.Form["Latitude"].Replace('.', ','));
            cinema.Longitude = Double.Parse(Request.Form["Longitude"].Replace('.', ','));
I don't understand why it's working like that but it is...

note that i'm using MVC2 RC

felipecsl wrote Apr 24, 2010 at 1:44 AM

I am still seeing this issue in the revision 47178. Lat and lon are getting a dot instead of a comma.

svelde wrote Jun 1, 2010 at 5:53 AM

It looks like the same bug still occurs with Dutch coordinates.

pmourfield wrote Sep 6, 2013 at 12:38 PM

Fixed in changeset 247e8445d80e5273ac9ef80dcbe96ac4ef3aa6ec