`
zhkchi
  • 浏览: 121230 次
  • 性别: Icon_minigender_1
  • 来自: 江苏
社区版块
存档分类
最新评论

解决Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount..错误

    博客分类:
  • .NET
ASP 
阅读更多
在用asp:DataGrid显示数据的时候,删除最后一页页面最后一条的时候,会出现:
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount..错误.

意思是说,当前页面的页码必须大于0以及小于总页数...
解决方法如下:


DataView dataView = getData("*");
                if(dataView.Count/dg.PageSize == dg.CurrentPageIndex)
                {
                    if(dg.CurrentPageIndex > 0)
                    {
                        dg.CurrentPageIndex -= 1;
                    }
                }


也就是当总记录数处以每页条数如果等于当前页码,就意味着这页没有记录,页码需要向前一页,不过有例外的是, 第一页要排除.
分享到:
评论

相关推荐

    Delphi7.1 Update

    * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and ...

    webservice-ajax

    &lt;br&gt;}&lt;br&gt;&lt;/script&gt;&lt;br&gt;&lt;/head&gt;&lt;br&gt;&lt;body&gt;&lt;br&gt;&lt;form id="form1" runat="server"&gt;&lt;br&gt;&lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;&lt;br&gt;&lt;Services&gt;&lt;br&gt;&lt;asp:ServiceReference Path="~/WebServices/...

    The Art of Assembly Language Programming

    Some Final Comments on the MOV Instructions&lt;br&gt;&lt;br&gt;4.9 Laboratory ...and CodeView'&lt;br&gt;4.9.5.1 A Quick Look at CodeView&lt;br&gt;4.9.5.2 The Source Window&lt;br&gt;4.9.5.3 The Memory Window&lt;br&gt;4.9.5.4 The Register ...

    BUS Hound

    extended scan code E0&lt;br&gt; 0004h = extended scan code E1&lt;br&gt;6 2 Not used&lt;br&gt;8 4 Device specific information&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;The Save Window&lt;br&gt;&lt;br&gt;The Save button saves all captured data to the ...

    spring mvc框架搭建

    &lt;property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/&gt; &lt;/bean&gt; ``` 这里,我们设置了 Velocity 视图解析器的前缀和后缀,并配置了 MyBatis 的 SqlSessionFactory 和 Mapper 扫描器。 对于 ...

    Visual C++ 编程资源大全(英文源码 字符串)

    StringSearch.zip&lt;br&gt;Case-Insensitive String Search(7KB)&lt;END&gt;&lt;br&gt;3,cCharCheck.zip&lt;br&gt;An MFC Class which offers you the abbility to check Strings for invalid characters(20KB)&lt;END&gt;&lt;br&gt;4,Tokenizer_src.zip...

    struts2_2校验框架

    &lt;message key="error.birthday"&gt;Percentage must be between 20.1 and 50.1.&lt;/message&gt; &lt;/field-validator&gt; &lt;/field&gt; ``` 这里`minInclusive`和`maxInclusive`参数指定了允许的最小和最大数值,同样地,如果输入...

    ProjectOZ

    It will&lt;br&gt;boot the skeletal BasicOZ and demonstrate how the trap, MMU, and CPU mechanisms work.&lt;br&gt;&lt;br&gt;There will be a continuous stream of drops of ProjectOZ over the summer with increasing&lt;br&gt;...

    Invalid name=”com.alibaba.dubbo.config.ProtocolConfig#0″

    java.lang.IllegalStateException: Invalid name=“com.alibaba.dubbo.config.ProtocolConfig#0” contains illegal character, only digit, letter, ‘-’, ‘_’ or ‘.’ is legal 原因: 如果没有指定id属性,...

    rdlc部署未能加载文件或程序集“Microsoft.ReportViewer.WebForms10.0

    在开发Web应用程序时,我们经常会遇到“未能加载文件或程序集”的错误,这通常是由于缺少必要的依赖或配置不正确导致的。在这个特定的场景中,标题指出的问题是关于"rdlc部署未能加载文件或程序集“Microsoft....

    新建Maven项目时出错:org.apache.maven.archiver.MavenArchiver.getManifest

    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt; &lt;version&gt;2.6&lt;/version&gt; &lt;configuration&gt; &lt;version&gt;3.1&lt;/version&gt; &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml...

    torchvision-0.14.0+cpu-cp310-cp310-win_amd64.whl

    torchvision-0.14.0+cpu-cp310-cp310-win_amd64.whl

    jstl-1.1.2.zip +配置步骤

    - **控制流标签**:`&lt;c:if&gt;`、`&lt;c:choose&gt;`、`&lt;c:when&gt;`、`&lt;c:otherwise&gt;`、`&lt;c:forTokens&gt;`、`&lt;c:forEach&gt;`、`&lt;c:forMap&gt;`、`&lt;c:while&gt;`等,用于条件判断和循环。 - **导入导出标签**:`&lt;c:set&gt;`、`&lt;c:remove&gt;`,...

    FileTypeAndIcon

    /// &lt;returns&gt;Returns a hash table which contains the file extension as keys, the icon file and param as values.&lt;/returns&gt; public static Hashtable GetFileTypeAndIcon() { try { // Create a ...

    VMware Workstation Pro 14导入ova报错问题解决方法(Invalid target disk adapter type pvscsi)

    &lt;ElementName&gt;SCSI controller 0&lt;/ElementName&gt; &lt;InstanceID&gt;3&lt;/InstanceID&gt; &lt;ResourceSubType&gt;lsilogic&lt;/ResourceSubType&gt; &lt;/Item&gt; &lt;Item&gt; &lt;Info&gt;Hard Disk information&lt;/Info&gt; &lt;Connection&gt;SCSI controller...

    Struts Validator验证器使用指南

    &lt;arg0 key="registrationForm.password.minSize" value="6"/&gt; &lt;/field&gt; &lt;!-- 更多字段定义... --&gt; &lt;/form&gt; &lt;!-- messages_zh_CN.properties 示例 --&gt; registrationForm.email.required=电子邮件地址不能为空 ...

    sqlalchemy

    &gt;&gt;&gt; fake_user = User(name='fakeuser', fullname='Invalid', password='12345') &gt;&gt;&gt; session.add(fake_user) &gt;&gt;&gt; session.commit() # 假设此处出现异常 Traceback (most recent call last): ... &gt;&gt;&gt; session....

    Universal Import Fixer (UIF) v1.2.rar

    2.fill &lt;Code Start&gt; with start address of code that you want to fix it. if you fill it with ZERO, UIF will fill it automatically. 3.fill &lt;Code End&gt; with End address of code that you want to fix it. ...

    【11.x推荐版本】AP无线接入点RGOS11.1(5)B9P11软件版本【适用于AP520】

    |&lt;0&gt; Exit To Main Menu | ============================================================================ Enter your choice(0-3): 3 【bootware模式下按3删除已经上传的文件】 Deleting the file in flash: ...

    xjar-4.0.1.jar

    xjar的4.0.1版本,便于加密gui开发时引用.访问jitpack.io 仓库 失败的可以下载,然后通过maven命令安装到本地仓库,直接应用即可. ...&lt;artifactId&gt;xjar&lt;/artifactId&gt; &lt;version&gt;4.0.1&lt;/version&gt; &lt;/dependency&gt;

Global site tag (gtag.js) - Google Analytics