I have a datasource that has an ID column. I'd like to display the page with the row that matches a [user-provided] ID. This could also be done two fold by (a) querying which page a particular datafield value is on; (b) displaying a particular page
2 Answers, 1 is accepted
0
Konstantin Dikov
Telerik team
answered on 27 Jul 2015, 12:37 PM
Hello Peter,
For finding the page holding the item with a given ID you can either temporarily disable the paging functionality, find the index of the item with that ID and calculate the page index. Afterwords you can specify the RadGrid's CurrentPageIndex property and rebind the grid.
Another option would be to traverse each page of the grid until you find the item in question:
if (item.GetDataKeyValue("ID").ToString() == searchedID)
{
itemFound = true;
}
}
} while (!itemFound && RadGrid1.CurrentPageIndex < RadGrid1.PageCount - 1);
if (!itemFound)
{
RadGrid1.CurrentPageIndex = originalIndex;
RadGrid1.Rebind();
}
}
Hope this helps.
Regards,
Konstantin Dikov
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