I had that problem and i think i fixed it (changed so many different
things im not sure!) by adding using the ViewState. This is what works
for me
private void dgCusomter_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
dgCusomter.CurrentPageIndex = e.NewPageIndex;
ViewState["CurrentPageIndex"] = e.NewPageIndex;
dgCusomter.DataBind();
dgCusomter.SelectedIndex = -1;
dgCusomter.EditItemIndex = -1;
dgCusomter.DataBind();
}
private void dgCustomer_SortCommand(object source,
System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
mySQLConnection sqlConn = new mySQLConnection();
this.dgGarda.CurrentPageIndex = 0;
ViewState["SortExprValue"] = e.SortExpression;
sqlComm_Customer = new SqlCommand();
sqlComm_Customer.Connection = sqlConn.GetConnection();
sqlComm_Customer.CommandText = "SELECT * FROM Customer "+
"ORDER BY "+e.SortExpression;
sqlComm_Customer.CommandType = CommandType.Text;
SqlDataAdapter daCustomer= new SqlDataAdapter(sqlComm_Customer);
daCustomer.Fill(dsCustomer);
dsCustomer.Tables[0].TableName = "Customer";
BindData();
}
Hope it does the trick!,
Steve