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

GridDataBoundControl

I have GridDataBoundGrid with two level.
How can I reference back to the datarow when user click on second level row or any row.

In grid grouping control, there is GridTableCellStyleInfoEventArgs.TableIdentity.Table.DisplayElement[index]
to reference back to GridRecordRow and then DataRowView.
What about GridDataBoundGrid?

Thanks

2 Replies

AD Administrator Syncfusion Team August 4, 2006 05:56 AM UTC

Hi Ken,

The GridDataBoundGrid is bound to the datasource using the CurrencyManager, using the CurrenCyManager the current record''s corresponding row index can be retrieved. Try the code snippet below.

GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
CurrencyManager cm = (CurrencyManager) this.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember];
DataRowView dv = (DataRowView) this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(cc.RowIndex).ListManager.Current;
Console.WriteLine(dv[1].ToString());

Regards,
Rajagopal


AD Administrator Syncfusion Team August 4, 2006 06:04 AM UTC

Hi Ken,

Sorry for the inconvenience. Please follow the code snippet below.

GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
DataRowView dv = (DataRowView) this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(cc.RowIndex).ListManager.Current;

Console.WriteLine(dv[1].ToString());

Thanks,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon