我的GridView有分页,每页10条记录,请问我怎么取出GridView中大于10条记录的值呀?

解决方案 »

  1.   

    在同一此postback触发的事件中,你可以取得,只要代码写成下面这样:
    protected DataTable dt = null;    
    private void BindData()
    {
           dt = new DataTable();
            //......
            this.GridView1.DataSource = dt;
            this.GridView1.DataBind();    
    }
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
       //这里可以随便访问dt中任意一行的值
    }
     protected void Button1_Click(object sender, EventArgs e)
    {
        //这里就不可以
    }*************
    如果你一定要,那么可以把dataTable保存进Session或ViewState