Datagrid format to 2 decimal places

tw79

Newcomer
Joined
Oct 19, 2004
Messages
3
Hi

I am binding a dataset to a datagrid and want to render the quantity field with 2 decimal places, even .00 if there is no decimal values. I have searched everywhere and tried

DataFormatString="{0:N2}" and also tried "{0:C}", "{0:d}", "{0:F2}" on the bound column but it doesn't appear to work...

please help

TW
 
That should work. I've use the same method before and it worked fine. Now though, I usually use templated columns and code-behind functions to do any "creative" formatting on my data.
 
Hi Jeff

thanks for the reply. That's what I was thinking. Does the column need to be any specific format. I have tried converting the column to a decimal as it is a string but that hasn't worked either....oh well...

thanks
TW
 
I just figured it out. I was loading the dataset from an xsd. The field has to be of type double in the xsd.

thanks
TW
 
Back
Top