473,569 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hello, everyone. I am getting an "Invalid CurrentPageInde x 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.Data Source = ds;
Line 206: dgCustInfo.Data Bind(); <----------------highlighted
Line 207: conn.Close();
Line 208:

The code on that method is:

private void editRow(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
//dgCustInfo.Edit ItemIndex = e.Item.ItemInde x;

SqlConnection conn = new SqlConnection
(ConfigurationS ettings.AppSett ings["SqlConnectionS tring"]);

conn.Open();

SqlCommand dataCommand = new SqlCommand();
dataCommand.Con nection = conn;
dataCommand.Com mandText = "SELECT GEM.customers.n ame AS [Institution
Name], "
+ "GEM.customers. CustomerSince AS [Customer Since], "
+ "GEM.contacts.n ame_first AS [First Name], "
+ "GEM.contacts.n ame_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.e mail AS [E-mail Address], "
+ "GEM.customers. cust_id "
+ "FROM GEM.customers INNER JOIN "
+ "GEM.config_use rnames ON "
+ "GEM.customers. cust_id = GEM.config_user names.cust_id INNER JOIN "
+ "GEM.contac ts ON GEM.config_user names.contact_i d =
GEM.contacts.co ntact_id "
+ "WHERE (GEM.customers. cust_id ='" + e.Item.Cells[16].Text + "')";

SqlDataAdapter adapter = new SqlDataAdapter( dataCommand);
DataSet ds = new DataSet();
adapter.Fill(ds );
dgCustInfo.Data Source = ds;
dgCustInfo.Data Bind();
conn.Close();
}
Jun 21 '06 #1
0 1352

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

Similar topics

3
14616
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 12345678910 3. the first page shows 10 records 4. if do a keyword search on the full dataset the selected records are returned...I can repeat this many...
1
3096
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" id="pt">
3
22294
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. The data is saved successfuly, but when the XML is later read the following error is encountered depending on the invalid character found: ...
1
2179
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 "DataGrid_setPage" try
1
1485
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 ( Object src, DataGridPageChangedEventArgs e ) {
0
1106
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 submit(Source As Object, e As EventArgs) if page.IsValid then MyDataGrid.CurrentPageIndex = 0 BindData()
3
1579
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 error and the recommendation has been to set the currentpageindex = 0. When I do this, it does not bring back the records in the grid that I am...
3
487
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 style=\"cursor:pointer\">"); strHref.Append(e.Item.Cells.Text+"</span></A>"); e.Item.Cells.Text=strHref.ToString();
1
11557
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 is invalid. Line 1, position 1. There is an error in XML document (0, 0). &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;MSVBalanceEnquiry...
0
7695
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.