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

How to get index from radGrid

1 Answer 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ramesh
Top achievements
Rank 1
Ramesh asked on 08 Jun 2015, 03:04 PM

Hi team,

I have a DataTable, which is used to bind my Radgrid. In my grid I have a Template column which creates a Link button . 

If I click the link button , I am getting my corresponding Datatable row index in itemCommand() by  "e.Item.DataSetIndex"  perfectily.

 

If I filtered my grid and click the link button, I am getting wrong Datatable row ID by  "e.Item.DataSetIndex". !

Please help , How can I get correct Datatable row id in filtered mode (itemCommand())?

 

Ramesh.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 11 Jun 2015, 10:50 AM
Hello Ramesh,

You can use the following approach to achieve this requirement:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "LinkButtonCommand")
    {
        string dataKeyValue = (e.Item as GridDataItem).GetDataKeyValue("OrderID").ToString();
    }
}

Hope this helps. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Ramesh
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or