How to get index from radGrid

2 posts, 0 answers
  1. Ramesh
    Ramesh avatar
    18 posts
    Member since:
    Apr 2015

    Posted 08 Jun 2015 Link to this post

    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.

  2. Eyup
    Admin
    Eyup avatar
    3843 posts

    Posted 11 Jun 2015 Link to this post

    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
Back to Top