DataGrid page level delete all error

G

Guest

Hi,
Here is my issue. I have a datagrid on my aspx page. I have paging enabled
for the datagrid. Suppose Suppose I have 3 pages in my datagrid. When I go to
the last page (which is the 3rd page here) and select all the messages and
delete, since the delete is on a page level, it deletes all the messages on
that page. But the problem is that since now my datagrid doesnt' have a 3rd
page and I am still on the 3rd page, its throwing an error. Any
ideas/solutions on how to tackle this.

Thanks in advance.
Pradeep
 
G

Guest

Keep a counter of the number of rows deleted (iNoOfRecordsDeleted) then
before you rebind the grid, check for:

If iNoOfRecordsDeleted = datagrid1.PageSize AndAlso
datagrid1.CurrentPageIndex = datagrid1.PageCount - 1 Then
datagrid1.CurrentPageIndex -= 1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top