asp.net mvc - What is the string format to display the zeros (minimum 3 digits) after the decimal point in cshtml view page? -
if value 3, should display 3.000, minimum 3 decimals.
for eg., if value 2.05, displaying 2.05 is. but, needs display 2.050.
code:
<span class="column-nos">@html.label("", string.format("{0}", nos[i].conversion.tostring()), new {@class = "numbers-conversion-value"})</span>
format values , not convert values string, drop tostring()
string.format("{0:0.000}", the_value)
your code should this:
<span class="column-nos">@html.label("", string.format("{0:0.000}", nos[i].conversion), new {@class = "numbers-conversion-value"}) </span>
Comments
Post a Comment