DataGrid Binding
Thank you in advance..Having an issue with custom paging when the form loads the data binds just fine when I click on thelink for the next set of data the PageIndexChanged doesnt seem to fire
public void PageIndexChanged(object sender, DataGridPageChangedEventArgs e)
{
CustomerListGrid.CurrentPageIndex = e.NewPageIndex;
nPageIndex = CustomerListGrid.CurrentPageIndex * CustomerListGrid.PageSize;
LoadData(nPageIndex,CustomerListGrid.PageSize);
}
public void LoadData(int nPageIndex, int nPageSize)
{
CustomerListGrid.DataSource = myCustomerList.GetCustomerList(nPageIndex,Customer ListGrid.PageSize);
CustomerListGrid.DataBind();
}
public SqlDataReader GetCustomerList(int nPageIndex, int nPageSize)
{
int nBaseProductID = nPageSize * nPageIndex;
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand myCommand = new SqlCommand("CustomerList", myConnection);
SqlParameter parameternPageSize = new SqlParameter("@nPageSize", SqlDbType.Int, 4);
parameternPageSize.Value = nPageSize;
myCommand.Parameters.Add(parameternPageSize);
SqlParameter parameternBaseProductID = new SqlParameter("@nPageIndex", SqlDbType.Int, 4);
parameternBaseProductID.Value = nBaseProductID;
myCommand.Parameters.Add(parameternBaseProductID);
myCommand.CommandType = CommandType.StoredProcedure;
myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConne ction);
return result;
}
|