472,958 Members | 2,657 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCoun

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 one. Can someone tell me what I
am missing?

The code highlighted with an error is:
Line 204: adapter.Fill(ds);
Line 205: dgCustInfo.DataSource = ds;
Line 206: dgCustInfo.DataBind(); <----------------highlighted
Line 207: conn.Close();
Line 208:

The code on that method is:

private void editRow(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
//dgCustInfo.EditItemIndex = e.Item.ItemIndex;

SqlConnection conn = new SqlConnection


SqlCommand dataCommand = new SqlCommand();
dataCommand.Connection = conn;
dataCommand.CommandText = "SELECT GEM.customers.name AS [Institution
Name], "
+ "GEM.customers.CustomerSince AS [Customer Since], "
+ "GEM.contacts.name_first AS [First Name], "
+ "GEM.contacts.name_last AS [Last Name], "
+ "GEM.customers.address_1 AS Address, "
+ "GEM.customers.city AS City, "
+ "GEM.customers.state AS State, "
+ "GEM.customers.province AS Province, "
+ "GEM.customers.zip_code AS [Zip Code], "
+ "GEM.customers.postal_code AS [Postal Code], "
+ "GEM.customers.country AS Country, "
+ "GEM.customers.phone AS Phone, "
+ "GEM.contacts.email AS [E-mail Address], "
+ "GEM.customers.cust_id "
+ "FROM GEM.customers INNER JOIN "
+ "GEM.config_usernames ON "
+ "GEM.customers.cust_id = GEM.config_usernames.cust_id INNER JOIN "
+ "GEM.contacts ON GEM.config_usernames.contact_id =
GEM.contacts.contact_id "
+ "WHERE (GEM.customers.cust_id ='" + e.Item.Cells[16].Text + "')";

SqlDataAdapter adapter = new SqlDataAdapter(dataCommand);
DataSet ds = new DataSet();
dgCustInfo.DataSource = ds;
Jun 21 '06 #1
0 1327

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

Similar topics

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...
by: Rafaela K. Azinhal | last post by:
Hi, I'm a newbie and have a question: I have following PivotTable object in a HTML page <html> <body> <object class='ptdrillthrough' classid="clsid:0002E552-0000-0000-C000-000000000046"...
by: Todd | last post by:
Our ASP.NET (C#) application accepts form entry and saves inputed data in XML. We are finding that users are sometimes cutting and pasting special characters (from MS Word) into these forms....
by: Kelvin | last post by:
Hi All, I try to use the following microsft resolution web site, but still have same problem. http://support.microsoft.com/default.aspx?scid=kb;en-us;555074 I put the source code on...
by: Kelvin | last post by:
Hi All, "disable view state for the datagrid." How to do that ? Please advise ! Here is also attached my sources code ------------------------------------------- void DetailGrid_setPage (...
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...
by: JackO | last post by:
I am getting the following error when I try to go to the second page of my datagrid: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount I have searched the other logs on this...
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...
by: ayemyat | last post by:
Hi All, I have a remoting service which consumes the web service in another server. I have the following exception throw by the web service. System.Xml.XmlException: The data at the root level...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.