删除后最后一页的PageIndex实际上已经不存在啦!
此时你应该自动将CurrentPageIndex 定位到前一页!

解决方案 »

  1.   

    因为你databind的pageindex已经不存在了,
    正如luckysusan(海闊天空)所说你要你应该自动将CurrentPageIndex 定位到前一页
    在每次datagrid的databind前加上一个判断,万无一失。
            Dim page As Integer
            page = DataGrid1.CurrentPageIndex
            DataGrid1.CurrentPageIndex = 0
            DataGrid1.DataBind()
            If page >= DataGrid1.PageCount And DataGrid1.PageCount > 0 Then
                page = DataGrid1.PageCount - 1
            End If
            DataGrid1.CurrentPageIndex = page
            DataGrid1.DataBind()
      

  2.   

    dgdData.CurrentPageIndex = Session("outpage")
            dgdData.DataSource = dv
            Try
                dgdData.DataBind()
            Catch
                dgdData.CurrentPageIndex = dgdData.PageCount - 1
                dgdData.DataBind()
            End Try