I have an ultragird bound to a datatable which contains columns of type decimal; I gave the grid columns that will display these numeric values the following format
column.Format =
"#,#.##";
Everything is working just fine for example number like 3567321 will be displayed as follows:
3,567,321 however when the value is 0.00 the cell will display blank and not 0.00
may you please advise?
This question has been answered here on the forums a number of times. Here's one:
Matching excel cell format to grid cell format - Infragistics Community
One more thing!
I'm exporting the grid to excel however the formatting is not taken into consideration!
Is this related to excel or I have to set some properties on the grid?
the format like "#,#.##;-#,#.##;0.0" didn't actually work
however I was able to work around it
the following format just worked fine
"#,#0.#0#";
Hi,
This isn't really anything to do with the grid, this is the way the DotNet Framework formats decimals.
You can see the same thing if you do this:
decimal d = 0;Debug.WriteLine(d.ToString("#,#.##"));
But I'm pretty sure there is a way to specify different formatting options for positive, negative, and zero values. You can find it in Microsoft's documentation here:
Standard Numeric Format Strings
Custom Numeric Format Strings
You will probably want to use a format like "#,#.##;-#,#.##;0.0"