I'm developing a ASP.NET MVC 4 application and I'm still a newbie for MVC. I noticed view render extra decimal places when I use Html.TextBox as follows.
@Html.TextBox("OriginalContractAmt", Model == null ? 0 : Model.OriginalContractAmt, new { @readonly = true })
OriginalContractAmt property is a NotMapped field in the model and view shows the value as 479.4000.
I would like to force it to two decimal places. i.e. 479.40. How do I archive it? Tried following in the model and it didn't make any difference.
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:0.0#}")]
Thanks in advance!