我使用了AspNetPager分页控件,有两种方式,一个是URL分页方式,一种是PostBack分页
我想知道如果Postback分页方式如何定位某一指定页,我在第三页操作至另一页,想回到第三页
怎么做,是不是要从VIEWSTATE着手?请高手指教一下,感激~

解决方案 »

  1.   

    Postback方式是不是带Page详细地址,所以传不了参数,不知道谁能帮我想想..感激
      

  2.   

    使用一个静态变量存储当前页的页码static int pageindex,然后重新绑定
      

  3.   

    能不能给帮我写段例子,我怎么试了不行,
    ...
    protected static int  Relpageindex=0;
    ...
    Relpageindex=Convert.ToInt32((Request.QueryString["Relpageindex"] == null)?"0":Request.QueryString["Relpageindex"]);
    ....  if(Relpageindex!=0)
    {
    PageCount=bll_Info.GetAllInfoByClassIDCount(curClassID);

    pager.RecordCount=PageCount;
    pager.CustomInfoText="当前页/总页数:"+Relpageindex+"/"+pager.PageCount+",每页记录:"+pager.PageSize;

    this.dgInfoList.DataSource=bll_Info.GetAllInfoByClassID(curClassID,pager.PageSize,Relpageindex);
    this.dgInfoList.DataKeyField="InfoID";
    this.dgInfoList.DataBind();
    }
    else
    {
    PageCount=bll_Info.GetAllInfoByClassIDCount(curClassID);

    pager.RecordCount=PageCount;
    pager.CustomInfoText="当前页/总页数:"+pager.CurrentPageIndex+"/"+pager.PageCount+",每页记录:"+pager.PageSize;

    this.dgInfoList.DataSource=bll_Info.GetAllInfoByClassID(curClassID,pager.PageSize,pager.CurrentPageIndex);
    this.dgInfoList.DataKeyField="InfoID";
    this.dgInfoList.DataBind();
    }