I have searched and found various methods for formatting as a string decimal values but cant fine one which covers all my needs.
I have to display a decimal value (a financial money figure) i.e. 2500.75
However I do not require any leading currency symbol such as $ or £
and the main point I am struggling with is that when the value has no value after the decimal do not display zeros.
I thought
was meeting my requirements initiall but then realized if someone put the value 7.4 in it was displayed as 7.4 when it should be displayed as 7.40.
I have also tried
But this seems to have no effect at all.
And in addition
always displays the two decimals even when zero.
I have to display a decimal value (a financial money figure) i.e. 2500.75
However I do not require any leading currency symbol such as $ or £
and the main point I am struggling with is that when the value has no value after the decimal do not display zeros.
I thought
Code:
.ToString(".##")
I have also tried
Code:
<%# String.Format("{0:0.##}", DataBinder.Eval(Container.DataItem, "Amount"))%>
And in addition
Code:
<%# String.Format("{0:0.C}", DataBinder.Eval(Container.DataItem, "Amount"))%>