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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -