We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridControl Custom Cell and Enum

Thread ID:

Created:

Updated:

Platform:

Replies:

62959 Jun 26,2007 12:27 PM UTC Jun 26,2007 08:48 PM UTC Windows Forms 1
loading
Tags: GridControl
Jim
Asked On June 26, 2007 12:27 PM UTC

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

haneefm [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;