ISPrincess
Programmer
I knew it was too good to be true. I have a datagrid that i just implemented Datapaging on - and that worked just swell, until.....
You delete the only record on the last page.
Say I have 6 rows in my datagrid and my pagesize is set to 5. If I page to the row #6 (2nd page) and click on Delete which deletes the record from the table and the only record that was on that page, then I retrieve the data again and rebind the grid. I get the following error:
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount
If, after a delete i just set the datagrid.currentpageindex = 0 that works fine, but I dont want to have to go to the first page anytime someone deletes a record.
Is there a way to easily set the datagrids.currentpageindex = datagrid.currentpageindex -1 whenever a user deletes the only record on the last page just before the databind?
PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
You delete the only record on the last page.
Say I have 6 rows in my datagrid and my pagesize is set to 5. If I page to the row #6 (2nd page) and click on Delete which deletes the record from the table and the only record that was on that page, then I retrieve the data again and rebind the grid. I get the following error:
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount
If, after a delete i just set the datagrid.currentpageindex = 0 that works fine, but I dont want to have to go to the first page anytime someone deletes a record.
Is there a way to easily set the datagrids.currentpageindex = datagrid.currentpageindex -1 whenever a user deletes the only record on the last page just before the databind?
PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips