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. Image for the cookie policy date
close icon

how to get correct cell value from gridgroupcontrol?

Hi,

I have a gridgroupcontrol with datatable as datasource.
I tried to get the cell value from col2 when I right click the row (from contextmenu).
I tried to directly get the data from datatable,but it does not work after the sorting. Then I tried to get the cell value based on the kep and then find the row the datatable. The problem is that I cannot find the method under groupctrol to get the corresponding cellvalue for the row i clicked (as I did in normal datagrid)?

Is there a (better) way to do it?

Thanks

Chrisben

1 Reply

AD Administrator Syncfusion Team August 7, 2006 05:15 AM UTC

Hi Chris,

Please try the code below in the TableControlCellClick event of the grid.

if(e.Inner.MouseEventArgs.Button == MouseButtons.Right)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
Console.WriteLine("newValue: {0} oldvalue: {1}", cc.Renderer.ControlText, e.TableControl.Model[cc.RowIndex, cc.ColIndex].CellValue);
GridTableCellStyleInfo style = e.TableControl.Model[cc.RowIndex, cc.ColIndex] as GridTableCellStyleInfo;
if(style != null)
{
Console.WriteLine("columnName: {0}", style.TableCellIdentity.Column.Name);
}
}

Let us know if you have any other questions.
Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon