我在datagrid设了链接列,但跳转回来时总是第一页
好像有人使用模板列传两个参数,但我不会用请各位老大指点1,2
最好vb代码,别的不会

解决方案 »

  1.   

    你可以用session在页面转向之前记录下datagrid的当前页数,有查询功能的还要记录当前查询关键字,返回到原来的页面时用记录的页数和查询关键字重新绑定datagrid就可以了。
      

  2.   

    就是说返回datagrid时候,怎么取得datagrid离开时所在的页码haidazi的方法能实现
    有没有内置的方法或更简单的
      

  3.   

    这个问题我已经解决了
    你可以看看我的  不过是C#.Net
    http://community.csdn.net/Expert/topic/4762/4762927.xml?temp=.4374658在DATAGRID中,添加记录后,如何返回记录的所在页 这个问题我已经解决,拿出来给大家看看  多提意见在添加页面
    Response.Redirect("***.aspx?addnew=new");在添加后跳转到显示的页面private void Page_Load(object sender, System.EventArgs e)
    {
       if(!Page.IsPostBack)
       {
         ***
         ***
         this.ViewState["addnew"]=this.Request["addnew"];
       }
    }
    数据绑定
    public void BindList()
    {
       ***
       ***
       ***   if(this.ViewState["addnew"]!=null)
         {
    this.ViewState["addnew"]=null;this.datagrid.CurrentPageIndex=this.分页控件名.PageCount-1;
    this.分页控件名.CurrentPageIndex=this.datagrid.CurrentPageIndex+1;
    this.BindList();
          }
    }//控件翻页
    private void 分页控件名_PageChanged(object src, NingBo.Controls.Web.PageChangedEventArgs e)
    {
       this.分页控件名.CurrentPageIndex=e.NewPageIndex;
       if(this.datagrid.PageCount>=e.NewPageIndex)
    {
      this.datagrid.CurrentPageIndex=e.NewPageIndex-1;
      this.BindList();
    }
    }根据大家提出来的方法,我采用  ViewState  做的,效果还不错,达到了要求
    分页控件是引用的(我们组长自己做的)