本文介绍了GridView分页不能正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我试图用GridView进行分页, ,并且我已经添加了GridView的PageIndexChanging方法, ,但是第二页返回一个空白页面。 我在做这样的代码时出错了吗? protected void GridView1_PageIndexChanging对象发件人,GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; GridView1.DataBind(); 解决方案添加这个 private void FillGrid() { GridView1.DataSource =Query ... GridView1.DataBind(); } 然后更改: protected void GridView1_PageIndexChanging(object sender,GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; FillGrid(); } I'm trying to make paging with GridView,and I have already added GridView's PageIndexChanging method,but the second page returns an empty page.What I'm doing wrong with this code ?protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e){ GridView1.PageIndex = e.NewPageIndex; GridView1.DataBind();} 解决方案 This problem has solved when I added thisprivate void FillGrid(){ GridView1.DataSource = "Query..." GridView1.DataBind();}And changed :protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e){ GridView1.PageIndex = e.NewPageIndex; FillGrid();} 这篇关于GridView分页不能正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-01 19:07