比如,我在页面加载时这样
    if (this.DataGrid1.CurrentPageIndex>this.DataGrid1.PageCount)
{              
this.DataGrid1.CurrentPageIndex=0;
}
还是一样,请各位帮帮忙,我都搞了一下午了,但还是没搞好!

解决方案 »

  1.   

    if (this.DataGrid1.CurrentPageIndex>=this.DataGrid1.PageCount) &
    (this.DataGrid1.CurrentPageIndex<0
    {              
    this.DataGrid1.CurrentPageIndex=0;
    }
      

  2.   

    if (this.DataGrid1.CurrentPageIndex>=this.DataGrid1.PageCount) &
    (this.DataGrid1.CurrentPageIndex<0)
    {              
    this.DataGrid1.CurrentPageIndex=0;
    }
      

  3.   

    同意smartyyp,就是搜索后判断当前页码和野马总数。
    不过你也可以不判断
    直接this.DataGrid1.CurrentPageIndex = 0;