Hi,
I would like to ask you for a method to page index change for large gridview that has large data becouse the page index change of this grid is so slow.
Thanks.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vasanth KrishnanPosted Sep 1, 2014, 8:20 AM
Add this method in the asp:Grid in aspx page
//Add OnPageIndexChanging and PageSize="30" as shown below.
PagerStyle-HorizontalAlign="Right" AutoGenerateColumns="False" CellPadding="1"
Font-Bold="False" Font-Names="Arial, Helvetica, sans-serif" Font-Size="12px">
//Add this line in the code behind
protected void gvProduct_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e)
{
string sMonth = ddlMonth.SelectedItem.Value;
string sYear = ddlYear.SelectedItem.Value;
try
{
string sCompanyCode = Session["CompanyCode"].ToString();
ds = new DataSet();
dt = new System.Data.DataTable();
//Retrieve the data set and assign it to data table
gvEmployee.PageIndex = e.NewPageIndex;
gvEmployee.DataSource = dt;
gvEmployee.DataBind();
}
catch (Exception ex)
{
}
finally
{
clsCommon.CloseDB();
}
}
I just give u the idea. Please try this and let me know the status if u wish.
Thanks
Osama ShatnawePosted Sep 1, 2014, 7:05 AM
Vasanth KrishnanPosted Sep 1, 2014, 3:11 AM