= 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
(ConfigurationSettings.AppSettings["SqlConnectionString"]);
conn.Open();
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();
adapter.Fill(ds);
dgCustInfo.DataSource = ds;
dgCustInfo.DataBind();
conn.Close();
}