Question

I have a gridview inside an updatepanel ,on first click the page index is changing but later clicks the page indexes are not changing. but the events are triggering when click. this is how i bind data.

protected void gvPurchaseDetails_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    gvPurchaseDetails.PageIndex = e.NewPageIndex;
    DetailsGridBind();
}

public void DetailsGridBind()
{

    DataSet dsInvoice = ObjDetail.GetPurchaseDetails();
    DataTable dtInvoice = dsInvoice.Tables[0];
    gvPurchaseDetails.DataSource = dtInvoice;
    gvPurchaseDetails.DataBind();     
}
Was it helpful?

Solution

Set EnableSortingAndPagingCallbacks="true" for your GridView

By default its set to false

Also in the code behind update your UpdatePanel

protected void gvPurchaseDetails_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    gvPurchaseDetails.PageIndex = e.NewPageIndex;
    DetailsGridBind();

    yourUpdatePanelId.Update();   // add this line of code was well
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top