My locale uses a comma ,, and not a dot . for decimal separator.
In MVC3, when I open an Edit view where the decimal values are shown with
@Html.EditorFor(model => model.MyDecimalVal)
the value is shown correctly.
When I enter value with comma, I get error “Value is not a number” and if I enter value with dot, I get no error, but actually no value is saved.
How to handle this situation?
Getting around with this by tweaking your validation logic has been already explained so here is a different approach.
Put the below code inside your web.config file under the
<system.web>node if you would like to set the culture toen. It will take care of decimal delimiter:I am not sure but for
DateTime, you are still bound to your server’s locale.