C# – telerik radgrid selecting item after inserting

asp.netcnettelerik

Im programatically changing dataSource of the grid by inserting item to the list. Then I do Rebind on the RadGrid. Ive got an id of newly inserted object. Then I would like select this row in grid. How can I do this from code behind ?

thanks for help

Best Answer

You have to set the ID as a DataKeyNames="yourID" for your grid. Then you can retrieve it in the code behind and set it selected like this:

GridDataItem gdiItem = RarGrid1.MasterTableView.FindItemByKeyValue("yourID", yourIDValue);
gdiItem.Selected = true;
Related Topic