Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 7th, 2006, 09:44 AM
Registered User
Join Date: May 2006
Location: Bristol, CT, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataGrid Error: Invalid CurrentPageIndex value.

I'm using a hyperlink on a crystal report within Business Objects to lanuch my ASP.NET 1.1 page with a DataGrid.
The datagrid is using the embedded Edit, Update, Cancel and paging options.

Everything goes fine, ie, paging, editing, update, etc., until they get the following error from the DataGrid_UpdateCommand function: "Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount." I'm unable to reproduce the error, and since we log errors into our database and get emailed when things go wrong, so I know people are receiving this error.

I've disabled the browser Back button, and this has reduced the number of times we get the error, but we still get it.

What would be causing the error?

Should I just direct people to page one of the grid when they get error?


Isa Paine
Software Developer
  #2 (permalink)  
Old December 15th, 2006, 06:33 AM
Skb Skb is offline
Authorized User
Join Date: Oct 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts

when u r getting error??? i mean on click of link or on pageload?

  #3 (permalink)  
Old December 15th, 2006, 10:00 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

I have seen this. It happens when they begin to page through their records and, if i remember correctly, it has to do with when you call the databind on the table you are paging through. Typically in a PageIndexChanged event handler you want to set the page index of the grid and then rebind it.

I use paging extensively on a few enterprise applications and I have never had a problem with that particular porition of the gird.


I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
  #4 (permalink)  
Old December 20th, 2006, 06:01 PM
Registered User
Join Date: Dec 2006
Location: Clearwater, FL, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

Did you assign your datasource to Session when you initially got your data source that way when you page through you wont have any problems.
private void prevPolicyDataGrid_PageIndexChanged(object source,System.Web.UI.WebControls.DataGridPageChang edEventArgs e)

    DataTable policyDT = (DataTable)Session["policyHistoryDT"];
    prevPolicyDataGrid.DataSource= policyDT;
    prevPolicyDataGrid.CurrentPageIndex = e.NewPageIndex;

Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid name Error in Excel 2003 pandian Excel VBA 1 November 28th, 2006 07:39 PM
Invalid Name Error in Excel 2003 pandian Excel VBA 0 October 9th, 2006 09:56 AM
Invalid use of property error. Bob Rupp BOOK: Beginning Access 2003 VBA 1 March 4th, 2005 09:09 AM
Viewstate Invalid Error mahulda ASP.NET 1.0 and 1.1 Basics 0 February 20th, 2004 11:36 PM
Datagrid Paging Error: Invalid CurrentPageIndex va Ron Howerton ADO.NET 0 October 22nd, 2003 08:17 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.