I am storing Amount in Decimal(18,2). But most of my data is actually integer with only few decimal. So when I display the amount for each item in the table, the number display is all 3.00, 4.00, 5.00 and so on.
I feel it is kind of weird to display all the 0 as the decimal point. I wish to format the number when display if the decimal point is 0.
Currently I am displaying the amount like this:
<td id="amnt@(item.FoodID)" class="amountfield">
@Html.DisplayFor(modelItem => item.FoodAmount)
</td>
Any idea?? Appreciate every help… thanks…
Looking at your code I assume that you are using ASP.Net MVC for your application. You can use DataAnnotation for formatting your data.
You can try using DisplayFormat in your model property.