what need if 5000 ----> 5000.00 if 5000.985 ----> 5000.99
always there should 2 decimal places.
this model class.
[display(name = "price (rs.)")] public double price { get; set; } this cshtml page (view).
<div class="display-label"> @html.displaynamefor(model => model.price) </div>
you can annotation.
[displayformat(dataformatstring = "{0:n2}", applyformatineditmode = true)] see this answer more information
Comments
Post a Comment