I have an entity that is managed by a WCF service, so the entity is generated through service reference so I cannot annotate it to specify data format.
It is decimal and must be formatted with 6 decimals.
How can I accomplish this in MVC3, in display and editor?
In display I could use
@Html.Display(format("{0:f4}", model.MyField))
It’s not very elegant, but it’s workable.
But how can I do this for formatting the editor with 4 decimals?
EDIT:
I found this answer to a similar question, but it gives me error in line
return html.TextBox(name, value, htmlAttributes);
Any idea how to solve it?
Thanks
I managed to make it as follows:
For display I used
for edit I used