I had the following problem. In my database I have an attribute which type is "float". When I create the model with Entity Framework, the same attribute is represented by a "double" field.
Here's the thing. In the view, if I write for example "23,22" the data annotation says it is not a number, and if I write "23.22" passes the validation but the attribute's value is null when it gets to the controller.
Any idea why does it happen? I've been looking for information, but nothing useful yet.
Thanks in advance!
Edit: I add the code where I use that attribute.
In the model class it is like this:
public class TestObject{
....
public Nullable<double> attribute { get; set; }
....
}
In the view:
@Html.EditorFor(m => m.attribute)
And in the controller:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Test(TestObject test)
{
....
return View();
}
If I write "23.22", when I access the attribute value in the controller, it is null.