I have a decimal value stored db as "12.3456" I want it to show it to client as "12.34"
I am using the code below .
<%# DataBinder.Eval(Container.DataItem, "Price", "{0:c}")%>
I want the format to be like this
12.3456 --> 12.34
but it's giving me this instead.
12.3456 --> 12.3500
I am not sure if I am missing something or did something wrong.
UPDATE
I end up doing with asp:Label instead of <%# DataBinder.Eval(Container.DataItem, "Price", "{0:c}")%>
Label Price.Text = Math.Truncate(12.3456* 100) / 100).ToString();
which gives me:
12.34
but if the number is 12.1000 it's giving me:
12.1
I need it in the 12.10 format