This is a migrated thread and some comments may be shown as answers.

GridDataItem.DataSetIndex (Is this right?)

3 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ADe
Top achievements
Rank 1
ADe asked on 24 Sep 2008, 12:10 PM
I am trying to find, given a GridDataItem the index of the DataRow in the DataTable it was bound from.

I thought DataSetIndex looked like the answer but it seems to return the index of the row in the GridView and not the index in the original DataTable i.e. if the user has sorted the grid it references the wrong DataRow.

What am I doing wrong?

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 26 Sep 2008, 11:24 AM
Hello ADe,

This information is only available in the itemDataBound event handler. If you access this value in a button click, for example, it will point to the index of the item in the masterTable.

Greetings,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brock
Top achievements
Rank 1
answered on 11 Nov 2008, 10:38 PM
Sorry -- I don't understand.

Is there a way to get the underlying index in the original data table from the radgrid selected item?

Or does this have to be done manually :(
0
Yavor
Telerik team
answered on 12 Nov 2008, 08:31 AM
Hi Brock,

Attached to this message, is a small application, which demonstrates the logic behind this property. Run the sample, and go to another page - 2, 3, etc. Select an item - the datasetIndex will be a value larger than the pagesize, i.e. the number of records on the current page.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
ADe
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Brock
Top achievements
Rank 1
Share this question
or