JJ
Jisha Joy
Syncfusion Team
June 11, 2009 09:25 AM UTC
Hi Mark,
If you are having record index of the underlying datasource, you could try using the ListManagerPositionToRowIndex method.This is used to find the row index within the grid from the row index within the data source.
this.gridDataBoundGrid1.Binder.ListManagerPositionToRowIndex(index);
Please let me know if this helps.
Regards,
Jisha
MK
Mark Kenner
June 11, 2009 05:15 PM UTC
Thanks for the reply.
I have tried ListManagerPositionToRowIndex. It worked untill I sorted the grid. After a sort it would still return the same value (where the row in the grid would have been if the grid was not sorted). Am I missing a step?
I can always put the key in the grid and hide it but I think there must be a better way.
RC
Rajadurai C
Syncfusion Team
June 13, 2009 11:27 AM UTC
Hi Mark,
Thanks for your update.
Please try the following code.
CurrencyManager cm = (CurrencyManager)this.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember];
int pos = this.gridDataBoundGrid1.Binder.PositionToRowIndex(0);
DataRow dr = ((DataRowView)cm.List[pos]).Row;
Console.WriteLine(dr[0].ToString());
This code retrieves the data value of the first column from the underlying row position. There is no other direct way found to get the position of underlying row after sorting in griddataboundgrid.It has to be handled through some code manually.
Regards,
Rajadurai