I’m developing a site in ASP.NET MVC 3.
Property
[DisplayName("Cost"), DisplayFormat(DataFormatString = "{0:F2}", ApplyFormatInEditMode = true)]
public decimal Cost { get; set; }
View
@Html.EditorFor(x => x.Cost)
The view renders Cost as 1000,00 (for example). The problem is, validation demands a point instead of a comma. How can I output 1000.00 instead of 1000,00? Or reverse the validation to accept the comma instead of a point?
Edit. I’ve set globalization in my web.config to sv-SE (Sweden).
You’ll need to write a Custom Model Binder to do this.
In your Global.asax file, add the following to your Application_Start Method