AD
Administrator
Syncfusion Team
February 22, 2005 09:37 PM UTC
Once the DataTable is sorted, the rowindex in the grid no longer matches the position in the datatable. Instead, it matches the position in the sorted DataView associated with the datatable.
So, in a sorted grid, if you want the DataRow associated with the grid row whose row index is gridRowIndex, then you should use code like:
CurrencyManager cm = (CurrencyManager)this.grid.BindingContext[grid.DataSource, grid.DataMember];
DataView dv = (DataView) cm.List;
int position = this.grid.Binder.RowIndexToPosition(gridRowIndex);
DataRow dr = dv[position].Row;