DrawCellDisplayText not called with Format containing #

I have a grid containing FormulaCells. For most of the cells I specify a .Format of ''N0'' or ''P1''. However, I also need to use ''#,''. I handle the DrawCellDisplayText event on the grid. When .Format is set to something that starts with #, the DrawCellDisplayText event is never raised for cells that have a zero or empty value. I''m not sure that there isn''t more to it, but if I change .Format from ''#,'' to ''0#,'' then DrawCellDisplayText again starts being raised for zero or empty cells.

4 Replies

TA Tom Abraham March 28, 2005 10:14 PM UTC

I''m not sure what the subtlety is in what the grid is doing, but this format ''#,##0,'' appears to work normally, while ''#,###,'' causes DrawCellDisplayText to not be raised. Perhaps because the grid is testing for an empty string?


AD Administrator Syncfusion Team March 28, 2005 11:49 PM UTC

You are correct. If the text is empty, DrawCellDisplayText is not raised.


TA Tom Abraham March 29, 2005 06:39 PM UTC

Trouble is, the value in these cells is 0. If you go to the cell and hit edit, a zero is displayed for edit. Hit Enter, and the cell goes blank. That''s a problem.


AD Administrator Syncfusion Team March 29, 2005 07:05 PM UTC

If you want to see a 0, then I think you will have to use #,##0. The behavior is from the .NET Framework. You see the same behvior if you try to format a zero with string.Format. Drop 3 lables on a form and add this code to the form load. The only one that shows a zero is the one with 0 in teh format. double d = 0; this.label1.Text = string.Format("{0:#,###,}", d); this.label2.Text = string.Format("{0:#,##0,}", d); this.label3.Text = string.Format("{0:#,###}", d);

Loader.
Up arrow icon