CurrentPageIndex invalid after a row deleted from datagrid

C

CW

Is this by design or is it a bug?

If you have a pageable datagrid. After you delete a row from the grid (which
results in a reduction in the number of pages of the datagrid), asp.net
throws an error because CurrentPageIndex is set to -1.

The error is thrown when you call the databind method on the datagrid after
the deletion from the underlying dataset.

I can get around it by checking the CurrentPageIndex value after a delete
statement (before calling DataBind). The code is ugly in order to determine
the proper total number pages. It's just annoying that I have to hack it
that way.

Any idea how to get around it? or DataGrid only has that much intelligence?
 
A

Andrew de la Harpe

No unfortunately you have to check the page index everytime.
My guess is that these little annoyances will be handled in ASP.NET 2.0.
Even if you didn't delete a row someone else may have.
A
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top