CellType = "Static" and currency format

Hi I want my grid to be static, because the user must not edit nor select any content on the cells, and at the same time i have columns that show currency numbers. I have tried: Grid.TableStyle.CellType = "Static" Grid.TableStyle.CellType = "Currency" but I only can assign one of those values at the same time. How can i make a cell static and, at the same time show its value in currency format?

2 Replies

AD Administrator Syncfusion Team June 6, 2006 12:46 PM UTC

Hi Roberto, There is no built-in support for this. You need to handle the DrawCellDisplayText event for coverting the display text to currency formated text. Here is a code snippet. this.gridControl1.TableStyle.CellType = "Static"; this.gridControl1.TableStyle.CellValue = 45.02; private void gridControl1_DrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs e) { if(e.RowIndex > 0 && e.ColIndex > 0) { if( e.DisplayText != null && e.DisplayText != string.Empty ) { double d = double.Parse(e.DisplayText); e.DisplayText = string.Format("{0:C}",d); } } } Let me know if you need any further assistance. Best Regards, Haneef


RM Roberto Martinez June 6, 2006 02:13 PM UTC

It works very well thank you

Loader.
Up arrow icon