Formatting decimals with 2 digits - 3.70 vs 3.7000 ???

T

Todd

I am formatting decimals on several columns within my DataGrid. For
the most part it is working correctly. However, 2 of the columns will
not format correctly. For example: the two columns that aren't
formating correctly are displaying 4 decimal places to the right.
Instead of getting: 3.70 I am getting 3.7000.

I am using the {0:F2} within the dataGrid property builder to get 2
decimal places to the right of the decimal point. This for some
reason is being "ignored" by my two troublesome columns, but works for
all the other decimal columns. Why would this work for some values,
and not others?
I have tried several different formatting functions inside the
code-behind page too, such as: format(value, F2) but that didn't work.
I have also tried using the D2 option but that doesn't work. For
some reason it is only occuring on these two decimal columns. Anyone
know why I get 4 decimal places instead of the two? And why does it
only happen on these 2 and not all the decimal values?
 
M

Mel Freeman

I don't know if this is any help, but this format string worked for me...

<%# DataBinder.Eval(Container, "DataItem.AWARD", "{0:#0.00}") %>

Mel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top