Thoroughly solve! Invalid CurrentPageIndex value. It must be greater than or equal to 0 and less than PageCount!

xiaoxiao2021-03-05  26

In multiple pagins of DataGrid, the last record of the last page is removed, often: invalid CurrentPageIndex value. It must be greater than or equal to 0 and less than PageCount. Description: Execute an unprocessed exception during the current web request. Check the stack tracking information to learn more about the error and the code caused in the code. Abnormal Details: System.Web.httpexception: Invalid CurrentPageIndex Value. It must be greater than or equal to 0 and less than PageCount. Now just add the following code, add it to the DataGrid's deleteCommand event, you can completely resolve an exception. Note: [protected system.web.ui.webcontrols.dataGrid DG]; if ((Dg.currentPageIndex == DG.PageCount-1) && Dg.Items.count == 1) {if (Dg.CurrentPageIndex-1> 1) {DG.CurrentPageIndex = DG.CurrentPageIndex-1;} else {dg.currentpageIndex = 0;}} this.open_sql (); DG.Database (); throwing brick 引玉, the purpose is to learn from everyone, thank you! ! ! I hope to be friends with everyone, please add me QQ - 126083810

转载请注明原文地址:https://www.9cbs.com/read-34880.html

New Post(0)