I'm posting some data from the client to the server like this
$.post(url, myData)
.done(function (data) {
});
here's the controller's action
public class MyModel
{
decimal Precision { get; set; }
}
[HttpPost]
public ActionResult PostInfo(MyModel postBack)
{
}
when I use the English culture PostInfo works as expected however when I change the culture to Spanish and Precision = 1,2 then I get the following error
The value 1,2 is not valid for Precision
Can someone please tell me why the default model binder is failing to parse 1,2 when the CurrentCulture is Spanish?
I change the culture in _Layout.cshtml. It's for testing purpose only.
@{
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("es", "ES");
}