473,322 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

CurrentPageIndex invalid after a row deleted from datagrid

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?
Nov 18 '05 #1
1 1801
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
"CW" <a> wrote in message news:OP**************@TK2MSFTNGP11.phx.gbl...
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?

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Meg | last post by:
Hi All, I am having a problem with paging in datagrid and need some idea as to how to handle the problem 1. the datagrid is first filled with a select * all 2. the datgrid shows 10 pages...
0
by: Kelvin | last post by:
Hi all, I have to using 2 radiobuttons to control 2 datagrid summay and detail representively. when I click detail radionbutton, there are 10 pages records. when I click summary radiobutton, I...
0
by: Kelvin | last post by:
Hi all, I have to 2 radiobuttons to control 2 datagrid summay and detail representively. when I click detail radionbutton, In detail report 10 pages records. In the summary report just only 1...
0
by: jm | last post by:
I get this error when I click one of the datagrids pages: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. It is not doing this on the submit as I have this: Sub...
1
by: CW | last post by:
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...
2
by: Sandy | last post by:
Hello - I have a datagrid and a dropdownlist (which is outside the datagrid). When I click on a category in the dropdownlist, the datagrid changes to correspond to that category. The datagrid...
3
by: Franck | last post by:
Hello, in a datagrid, in the ItemDataBound event in some cells a add some javascript that show up an information strHref.Append("<A onclick=\"popupValid();\">"); strHref.Append("<span...
1
by: Rajani | last post by:
Hello, I am displaying data from database in datagrid. DG is having edit and delete features. Pagesize is 10. I have total 12 records(2 pages). Now i am deleting 12th and 11th records. Delete...
0
by: Antonio | last post by:
Hello, everyone. I am getting an "Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount." error message when I click on the Edit button on any pages in the datagrid besides the first...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.