GridView分页记录,记录给自己

1.前台页面文件注意设置DataKeyNames

 

2.在pageIndexChanging事件中

 

代码
     protected   void  GridView1_PageIndexChanging( object  sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex 
=  e.NewPageIndex; // 设置新的页码
         this .GridView1.DataSource  =  vote.getParticipateForm( " all " , surid); // 绑定数据
         this .GridView1.DataBind();
    }

 

 

你可能感兴趣的:(GridView)