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的值,如果不符合條件就會拋出異常,不會給下面的語句以執行的機會!
新聞熱點
疑難解答
圖片精選