I am wanting to programmatically select a page (item?) from the DataForm during page_load from a querystring.
I am using a RadListView for selecting an item and displaying/passing the RadListView's selection to the DataForm by making use of the ListView's DataItemIndex.
It seems to work as both controls are bound to the same datasource. (I was worried that perhaps the ordering and indexes would not match up between the two controls, but so far it seems to be fine).
It looks something like this:
protected void RequestsListView_ItemCommand(object sender, RadListViewCommandEventArgs e)
{
if (e.CommandName == "ItemSelect")
{
SelectedRequestDataForm.CurrentPageIndex = ((RadListViewDataItem)e.ListViewItem).DataItemIndex;
}
}
So my question is how do I basically do the same thing but instead of using DataItemIndex / CurrentPageIndex... how can I just use actual field values to match and select on? Can I set the selected page of the DataForm by matching a value of a particular page's DataKey (or any field)?
I have looked through the API reference to see if there was anything besides CurrentPageIndex that I could use, but I haven't found one. One idea I've had is to just loop through all pages and on each page attempt to match a DataItem's value... then use CurrentPageIndex to get the value. But, there doesn't seem to be a collection that corresponds to all the pages associated to the DataForm. Oddly enough, there is a PageCount property though!
What might I do? Does DataPager already accomplish all this and I just don't realize it?