Skip to main content

PivotGridCallbackStateEventArgs.Handled Property

Gets or sets whether a callback state saving/loading operation is handled manually, so no default processing is required.

Namespace: DevExpress.Web.ASPxPivotGrid

Assembly: DevExpress.Web.ASPxPivotGrid.v22.1.dll

Declaration

public bool Handled { get; set; }

Property Value

Type Description
Boolean

true, to use the custom callback state saving/loading mechanism; otherwise, false.

Example

This example demonstrates how the ASPxPivotGrid.CustomSaveCallbackState and ASPxPivotGrid.CustomLoadCallbackState events can be handled to preserve the ASPxPivotGrid’s callback state within a Session.

View Example

<dxwpg:ASPxPivotGrid ID="ASPxPivotGrid1" runat="server" 
OLAPConnectionString="provider=MSOLAP;
                        data source=https://demos.devexpress.com/Services/OLAP/msmdpump.dll; 
                        initial catalog=Adventure Works DW Standard Edition;
                        cube name=Adventure Works;" 
OnCustomLoadCallbackState="ASPxPivotGrid1_CustomLoadCallbackState" 
OnCustomSaveCallbackState="ASPxPivotGrid1_CustomSaveCallbackState">
    <Fields>
        <dxwpg:PivotGridField ID="fieldCountry1" Area="RowArea" AreaIndex="0" 
            Caption="Country"
            FieldName="[Customer].[Country].[Country]">
        </dxwpg:PivotGridField>
        <dxwpg:PivotGridField ID="fieldCity1" Area="RowArea" AreaIndex="1" 
            Caption="City"
            FieldName="[Customer].[City].[City]">
        </dxwpg:PivotGridField>
        <dxwpg:PivotGridField ID="fieldCustomerCount" Area="DataArea" AreaIndex="0" 
            Caption="Customer Count"
            FieldName="[Measures].[Customer Count]">
        </dxwpg:PivotGridField>
    </Fields>
</dxwpg:ASPxPivotGrid>
using System;
using DevExpress.Web.ASPxPivotGrid;

public partial class _Default : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {

    }
    string GetPivotStateID(ASPxPivotGrid pivotGrid) {
        return GetType().FullName + "_" + pivotGrid.ID;
    }
    protected void ASPxPivotGrid1_CustomSaveCallbackState(object sender, 
                                  PivotGridCallbackStateEventArgs e) {
        Session[GetPivotStateID((ASPxPivotGrid)sender)] = e.CallbackState;
        e.CallbackState = null;
        e.Handled = true;
    }
    protected void ASPxPivotGrid1_CustomLoadCallbackState(object sender, 
                                  PivotGridCallbackStateEventArgs e) {
        e.CallbackState = (string)Session[GetPivotStateID((ASPxPivotGrid)sender)];
        e.Handled = true;
    }
}
See Also