在做DataBind之前判断当前DataTable的数量:
If dtCart.Rows.Count = dgCart.PageSize * dgCart.PageCount And dgCart.CurrentPageIndex > 0 Then
dgCart.CurrentPageIndex = dgCart.CurrentPageIndex - 1
End If
If dtCart.Rows.Count = dgCart.PageSize * dgCart.PageCount And dgCart.CurrentPageIndex > 0 Then
dgCart.CurrentPageIndex = dgCart.CurrentPageIndex - 1
End If
解决方案 »
- 请问各位装vs2008 SP1,大家用了多长时间?急死我了
- 如何将gridview的值插入到数据库另外一个表呢?
- 进入某页面时有传参,但在该页面点查询后由于不传了报错
- 如何把dataset赋给一个string变量?
- 找不到类型或命名空间空间 ajax
- 求一段代码——用于实现树型CheckBoxList父子节点间“同步选中/取消”的效果
- 二级域名原理以及程序,申请即可开通
- 快吞学了,为什么我安装的VS。NET不能运行?100分求元
- 怎样在Tabel的一个TD中加上滚动条?
- 我安装了.net框架软件包(中文版的),是不是就可以运行aspx了?
- 巨奇怪的问题 出现在 SQL Server 不存在或访问被拒绝!
- 请问那位大侠有关于net注释的详细列表
我讲你的代码放在了dgCart_ItemCommand()事件中的dtCart.DataBind()之前
结果还是不行:-(
dgrdApplyList.DataSource = objDataView
Dim intMaxPageIndex As Integer = (objDataView.Count - 1) \ dgrdApplyList.PageSize
If dgrdApplyList.CurrentPageIndex > intMaxPageIndex Then
dgrdApplyList.CurrentPageIndex = Math.Max(0, intMaxPageIndex)
End If
dgrdApplyList.DataBind()