我返回一个DataSet,然后绑定到DataGrid,我用Grid.PageCount得到却不是实际的页数,PageCount总是等于1。
  出现这个问题的原因是哪里呢?

解决方案 »

  1.   

    我设置了自定义分页PageSize我也设置了。
      

  2.   

    把你的绑定代码贴出来,有没有设置VirtualItemCount的值?
      

  3.   

    在DataGrid的属性中,设置AllowPaging=true;PageSize=5;就可以了
      

  4.   

    对这个问题,我看了别人的代码,有的是用了一条新的sql语句来重新获得DataGrid的页数,所以我感觉有些迷惘,DataGrid.PageCount不是得到总页数吗?
      

  5.   

    MyDataGrid.CurrentPageIndex = e.NewPageIndex;
    MyDataGrid.DataBind();