this.DataGrid1.DataSource=ds;
this.DataGrid1.databind();
.........

解决方案 »

  1.   

    系统说当前页码已经超出Page.count的范围了。
      

  2.   

    DataGrid1.CurrentPageIndex = Session("outpage")  -->参数见下
            DataGrid1.DataSource = dv
            Try
                DataGrid1.DataBind()
            Catch
                DataGrid1.CurrentPageIndex = dgdData.PageCount - 1
                DataGrid1.DataBind()
            End Try------------------------------
    Private Sub Datagrid1_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles Datagrid1.PageIndexChanged
            Session("outpage") = e.NewPageIndex
            BindGrid()   -->绑定数据库的方法。
        End Sub