post 上的 ASPxPivotGrid 丢失数据

ASPxPivotGrid Loss data on post back

我在页面加载时将数据源附加到 ASPxPivotGrid 它显示数据,当按下筛选、排序或分页按钮时它丢失数据。

private void LoadBankDetail1(string branch, DateTime dateFrom, DateTime dateTo, string accounts)
 {

            ASPxPivotGrid1.DataSource = aglTransact.GetBankDetail(branch, dateFrom, dateTo, accounts, inputIncludOb.Checked);
}


<dx:ASPxPivotGrid ID="ASPxPivotGrid1" runat="server" ClientIDMode="AutoID"  EnableTheming="True" OnDataBinding="ASPxPivotGrid1_DataBinding" Theme="MaterialCompact">
    <Fields>
        <dx:PivotGridField ID="fieldaccountdesc" Area="RowArea" AreaIndex="1" Caption="Account" FieldName="account_desc" Name="fieldaccountdesc">
        </dx:PivotGridField>
        <dx:PivotGridField ID="fieldperiod" Area="ColumnArea" AreaIndex="0" Caption="Period" FieldName="period" Name="fieldperiod">
        </dx:PivotGridField>
        <dx:PivotGridField ID="fieldamount" Area="DataArea" AreaIndex="0" Caption="Amount" FieldName="amount" Name="fieldamount">
        </dx:PivotGridField>
        <dx:PivotGridField ID="fieldbranchdesc" Area="RowArea" AreaIndex="0" Caption="Branch" FieldName="branch_desc" Name="fieldbranchdesc">
        </dx:PivotGridField>
        <dx:PivotGridField ID="fieldbranchdesc1" AreaIndex="0" Caption="Branch" FieldName="branch_desc" Name="fieldbranchdesc1">
        </dx:PivotGridField>
    </Fields>
</dx:ASPxPivotGrid>

确保在每个请求期间调用“LoadBankDetail1”过程(在其中分配 ASPxPivotGrid1.DataSource),即不在 Page_Load 上的“if (!IsPostBack)”之类的内容下:

protected void Page_Load(object sender, EventArgs e) {
    LoadBankDetail1(...);
}