Skip to main content
A newer version of this page is available. .

DashboardState Class

A data container for changes resulting from end-user interaction - selected master filter values, drill-down levels, selected dashboard item layers and current parameter values.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v18.2.Core.dll

Declaration

public class DashboardState

Remarks

The DashboardState class includes states of individual dashboard items (the DashboardState.Items property) and currently selected parameter values (DashboardState.Parameters).

See the details about the platform specifics below:

DashboardState in ASP.NET

The table below lists main server-side and client-side API members related to obtaining and setting a dashboard state.

API

Server-side

ASPxDashboard.InitialDashboardState / DashboardExtensionSettings.InitialDashboardState

ASPxDashboard.SetInitialDashboardState

DashboardConfigurator.SetDashboardStateService

ASPxDashboard.IncludeDashboardStateToUrl / DashboardExtensionSettings.IncludeDashboardStateToUrl

Client-side

ASPxClientDashboard.GetDashboardState

ASPxClientDashboard.SetDashboardState

ASPxClientDashboard.DashboardStateChanged

Note that on the client side, a dashboard state is represented by a JSON object, that can be used to initialize DashboardState using the DashboardStateExtensions.LoadFromJson extension method. To save the current DashboardState to JSON, use DashboardStateExtensions.SaveToJson.

You can also apply a specified dashboard state when performing server-side exporting using methods exposed by the ASPxDashboardExporter, for instance:

The sample illustrates how to specify a dashboard state (such as master filter or parameter values) in code and how to apply this state when loading a dashboard for the first time. In this example, the DashboardState object holds the required dashboard state. The ASPxDashboard.SetInitialDashboardState event is used to apply the specified dashboard state when loading a dashboard.

using DevExpress.DashboardCommon;
using DevExpress.DashboardWeb;
using System;
using System.Collections.Generic;

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

        protected void ASPxDashboard1_SetInitialDashboardState(object sender, SetInitialDashboardStateEventArgs e) {
            e.InitialState = InitializeDashboardState();
        }

        public DashboardState InitializeDashboardState() {
            DashboardState dashboardState = new DashboardState();

            DashboardParameterState parameterState = 
                new DashboardParameterState("countryParameter", "USA", typeof(string));

            DashboardItemState gridFilterState = new DashboardItemState("gridDashboardItem1");
            gridFilterState.MasterFilterValues.AddRange(new List<object[]>() {
                new string[1] { "Andrew Fuller" },
                new string[1] { "Laura Callahan" }
            }
            );

            DashboardItemState treemapDrilldownState = new DashboardItemState("treemapDashboardItem1");
            treemapDrilldownState.DrillDownValues.Add("Beverages");

            DashboardItemState rangeFilterState = new DashboardItemState("rangeFilterDashboardItem1");
            rangeFilterState.RangeFilterState.Selection = 
                new RangeFilterSelection(new DateTime(2015, 1, 1), new DateTime(2016, 1, 1));

            dashboardState.Parameters.Add(parameterState);
            dashboardState.Items.AddRange(new List<DashboardItemState>() {
                gridFilterState,
                treemapDrilldownState,
                rangeFilterState }
            );
            return dashboardState;
        }
    }
}

To learn more about a dashboard state, see Manage Dashboard State.

DashboardState in WPF

Use the GetDashboardState() and SetDashboardState(DashboardState) methods to obtain and apply the dashboard state, respectively.

To restore the previously saved dashboard state, handle the SetInitialDashboardState event.

For more information. refer to the Manage Dashboard State article.

Inheritance

Object
DashboardState
See Also