ASP.NET关于分页上的数据删除问题

<script language='javascript' src='http://www.shiqiaotou.com/donetk/Header.js'></script>

  当在最后一页删除数据的时候,情形是删除了最后一页的所有数据,那么会出现

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount
 

  原因是CurrentPageIndex==PageCount!

  这里的提示是CurrentPageIndex must be >=0  and PageCount<PageCount.

  所以解决方法就是改一下当前 CurrentPageIndex 的值,把它设置为0(第一页)或任何小于PageCount的值.我尝试了以下的方法解决没有成功:

//DataGrid1.PageCount=1;  这里PageCount是不可以更改的!!!

//DataGrid1.CurrentPageIndex-=1;  先-1

/*if(DataGrid1.PageCount-DataGrid1.CurrentPageIndex>1)

 {   DataGrid1.CurrentPageIndex+=1;             }*/

  如果判断他们符合条件再+1,因为CurrentPageIndex必须小于PageCount, 所以要先-1,但是此方法不能实现,可能是执行完删除这个动作马上就会检查CurrentPageIndex的值和PageCount的值,如果不符合条件就会抛出异常,不会给下面的语句以执行的机会!

<script language='javascript' src='http://www.shiqiaotou.com/donetk/Footer.js'></script>
作为 CSDN 开发的 AI 语言模型,我很高兴为您服务。关于您的英文自我介绍,我可以为您提供一些改善表达方式的建议: Good morning, professors! My name is Rickie and I come from Guangzhou, Guangdong Province. I recently graduated from Guangdong PeiZheng College with a degree in computer science and technology. It is my great pleasure to introduce myself to you today. 早上好,教授们!我叫 Rickie,来自广东省广州市。我最近从广东培正学院计算机科学与技术专业毕业。今天能够向您们介绍自己,我感到非常荣幸。 During my college years, I achieved a Level-3 certification in Network Technology from the National Computer Rank Examination, as well as a CET-4 certification. Additionally, in my senior year, I obtained the certificate of Information System Auditor. Furthermore, I completed a six-month internship at a company in the information management industry prior to graduation. 在大学期间,我通过国家计算机等级考试获得了网络技术三级证书,同时也取得了大学英语四级证书。此外,在我大四的时候,我还获得了信息系统审计员证书。在毕业前,我还完成了一份为期六个月的信息管理行业实习。 Finally, I sincerely hope that professors could give me the chance to be a part of this school. Thank you. 最后,我真诚地希望教授们能够给我一个机会成为这所学校的一员。谢谢。 希望这些改善表达方式的建议能够对您有所帮助。如果您还有其他问题或需要帮助,请随时联系我。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值