1

我在更新面板中有一个gridview,第一次点击页面索引正在改变,但后来点击页面索引没有改变。但是点击时会触发事件。这就是我绑定数据的方式。

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();     
}
4

1 回答 1

1

EnableSortingAndPagingCallbacks="true"为您设置GridView

默认情况下,其设置为false

同样在更新你的代码后面UpdatePanel

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

    yourUpdatePanelId.Update();   // add this line of code was well
}
于 2013-04-10T07:18:47.420 回答