GridControl Custom Cell and Enum

Hi,

we are using a gridcontrol in virtual mode with a custom cell renderer. The same renderer is also used in a GridGroupingControl and works fine there.

In the gridcontrol there seems to be a problem with the custom renderer. I have attached a sample to demonstrate the behavior.

The sample grid contains two columns. The second column consists of custom cell types ("EnumCell"). When you change a value in a cell of this column - the value isn't saved.

Can you tell me what's wrong here? - Why does the same cell renderer work in a GGC?

Thanks in advance,
Jim

VirtualGridIssue.zip

1 Reply

HA haneefm Syncfusion Team June 26, 2007 08:48 PM UTC

Hi Jim,

In addition to handling the QueryStyleInfo, QueryRowCount and QueryColCount, you have to handle the SaveCellInfo event. In your handler, you must save the changes back to your external data source. The attached sample below implements a virtual grid that allows you to change the data. Below is a code snippet that show this task.

//Form's Load.
gridControl1.SaveCellInfo += new GridSaveCellInfoEventHandler(OnSaveCellInfo);

void OnSaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
{
if (e.RowIndex > 0 && e.ColIndex > 0)
{
if (e.ColIndex == 1)
{
m_List[e.RowIndex - 1].FirstColumn = e.Style.Text;
}
else if (e.ColIndex == 2)
{
if (m_List[e.RowIndex - 1].SecondColumn.GetType().IsEnum)
{
MyEnum objenum = (MyEnum)e.Style.CellValue;
m_List[e.RowIndex - 1].SecondColumn = objenum;
}
e.Handled = true;
}
}
}

See the KB article for more details.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=47

Best regards,
Haneef

Loader.
Up arrow icon