When converting a string to decimal using Convert.ToDecimal()
in the razor engine, I want the result to be rounded off to the nearest integer value.
I have attempted to use Math.round
, Math.ceil
, and String Format
, but so far none of them have been successful.
<td data-value="TotalFeesNumeric" data-negative="true" class="lp_currency_format">
@{if (@Model.CalculatedBreakevenSummary != null &&
@Model.CalculatedBreakevenSummary.TotalFeesNumeric != null)
{@Convert.ToDecimal(Model.CalculatedBreakevenSummary.TotalFeesNumeric)}}
</td>
The output is not an integer as desired.