473,388 Members | 1,234 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,388 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 1805
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.