Thx for your answer but I can't get it right. I have the code below implemented but I encounter the follow problems
I have 5 items bound to my ListView with a PageSize = 4, so two pages in total.
This is the scenario:
The ListView is set on PageIndex = 0, showing 4 items.
I start looking for an item with productId = 3. The first loop (CurrentPageIndex = 0) the this.lstProducts.Items.Count indicates that it holds 4 items. In the second loop the CurrentPageIndex is set to 1. Now, the this.lstProducts.Items.Count indicates that it holds 1 item.
Because the productid was found among the items of PageIndex = 0, the ListView is set to PageIndex = 0. This all correct.
But, now I have found an item with a productId that is located in de itemset in PageIndex = 1. The CurrentPageIndex is set to 1 (one image is shown in the ListView. This is still correct.
When I start looking for another item (and CurrentPageIndex is still 0 which equals 1 item) this is what happens:
In code the CurrentPageIndex is set to 0 but now this.lstProducts.Items.Count = 1 instead of 4. In the next loop (CurrentPageIndex is set to 1) the this.lstProducts.Items.Count is also 1 (which is correct for PageIndex =1)
What I'm I doing wrong? or overlook?
Than a another question about paging of the ListView. Which event is fired when I change PageIndex. For now I bind the ListView on my Page_PreRender event but I think that is going to give problems when I try to set a specified item in the ListView (see original problem).
I hope you can help me a little bit further because it gives me a little bit of a headache by now ;-(
int pageCount = lstProducts.PageCount;
bool stop = false;
for (int pageIndex = 0; pageIndex < pageCount; pageIndex++)
lstProducts.CurrentPageIndex = pageIndex;
foreach (Telerik.Web.UI.RadListViewDataItem itemRow in this.lstProducts.Items)
ImageButton oButton = itemRow.FindControl("SushiImage") as ImageButton;
if (oButton != null)
if (oButton.CommandArgument == ProductItemId.ToString())
stop = true;
currentPageIndex = pageIndex;