Quite simple question, but I am having loads of issues with it.
protected void restorePagerNumber()
{
if (Session["PageNumber"] != null)
{
System.Diagnostics.Debug.Write(Session["PageNumber"]);
DataPager pager = searchListView.FindControl("searchDataPager") as DataPager;
pager.SetPageProperties((int)Session["PageNumber"] * pager.PageSize, pager.MaximumRows, false);
}
}
Thats what I currently have, I tried to use it before databind, after data bind, none of them seem to work. Can I actually change pager
value after creating new object?
Doesnt sound logical, but I cannot access datapager
without that. Is there another way to access dataPager
that is in a listView
and maybe another way to set its page number.
Cheers
I found a scenario that is similar to yours (https://web.archive.org/web/20210125144848/http://www.4guysfromrolla.com/articles/021308-1.aspx) and I verified that the sample application works calling SetPageProperties() at run-time.
Be sure to change the last "databind" argument in your SetPageProperties call to from False to True:
then make sure you're calling restorePagerNumber at PageLoad
Hope that helps.