virtual grid: formating cell values

Hello, i use a virtual grid. In this grid are columns with different formats. In one of these columns i use the type "double". if i put a number like "1.345234 " in the grid and set the format "e.Style.Format = "#.###";", the number is formated to "1.345". If i click in these cell, the value "1.345" remains, but I will that the unformated value "1.345234" appears. The GridSaveCellInfo should save the value "1.345234" and not "1.345". Is it possible?

5 Replies

TI Tino January 12, 2006 05:14 PM UTC

Therefore only if the cell is in edit-mode, the quite number should appear and if i change this number, the quite decimalplaces should be stored.


ST stanleyj Syncfusion Team January 12, 2006 05:44 PM UTC

Hi Tino, DrawCellDisplayText can be made use for your expectation, please comment out Style.Format that was set earlier and try this. private void gridControl1_DrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs e) { if(e.ColIndex == 4 && e.RowIndex > 0) { double d = (double)e.Style.CellValue; e.DisplayText = string.Format("{0:#.###}", d); } } Best regards, Stanley


TI Tino January 13, 2006 08:38 AM UTC

Hello Stanley, thanx for the fast response. That sounds logic. I have tried, but there is no definition for ''colIndex''in Syncfusion.Windows.Forms.GridDrawCellDisplayTextEventArgs''. Best regards, Tino.


ST stanleyj Syncfusion Team January 13, 2006 09:39 AM UTC

Hi Tino, Refer this sample. If this does not work, check out 4.1 beta here. http://www.syncfusion.com/support/forums/message.aspx?MessageID=39029 Best regards, Stanley


TI Tino January 13, 2006 09:56 AM UTC

O.K. I have tried it at that way: private void gridControl1_DrawCell(object sender, GridDrawCellEventArgs e) { if(e.ColIndex == 1 && e.RowIndex > 0) { e.Style.Format = "0.##"; } } That works. Is this O.k.?

Loader.
Up arrow icon