Skip to main content

Manage Dashboard State in ASP.NET Web Forms Applications

  • 6 minutes to read

A dashboard state describes the result of client actions users perform on a dashboard. The DashboardState class contains:

You can manage the following objects in a dashboard state:

State Value


selected master filters values


current drill-down levels


a selected tab page


Range Filter/Date Filter settings


a selected dashboard item layer[1]


selected parameter values


API Overview

On a server side, a dashboard state is represented by the DashboardState class that includes states of individual dashboard items (the DashboardState.Items property) and currently selected parameter values (DashboardState.Parameters). On a client side, a dashboard state is a JSON object that stores the same data. The table below lists main server-side and client-side API members related to obtaining and setting a dashboard state:










To initialize the DashboardState object using a JSON object obtained from a client side, use the DashboardStateExtensions.LoadFromJson extension method. Use DashboardStateExtensions.SaveToJson to save the current DashboardState to JSON.

Include a Dashboard State to URL

Users can share a dashboard state by appending it to the URL of the currently browsed dashboard. To do this, enable the ASPxDashboard.IncludeDashboardStateToUrl property.

In this case, the resulting link allows users to open the dashboard with the specified state. Note that these properties are in effect when the ASPxDashboard.WorkingMode is set to WorkingMode.Viewer or WorkingMode.ViewerOnly.


You can also include the identifier of the selected dashboard to URL using the ASPxDashboard.IncludeDashboardIdToUrl property.

Apply a Dashboard State during Server-Side Export

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

To learn more, see Manage Exporting Capabilities.

Example 1: Specify a Default Dashboard State

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.

View Example: How to specify a default dashboard state in code

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");

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

            dashboardState.Items.AddRange(new List<DashboardItemState>() {
                rangeFilterState }
            return dashboardState;

Example 2: Save a Dashboard State to Cookies

The sample illustrates how to save the current ASPxDashboard state (such as master filter or parameter values) to cookies on the client side and restore this state on the server side. The following API is used in this example:

View Example: How to save a dashboard state to cookies

using DevExpress.DashboardCommon;
using DevExpress.DashboardWeb;
using System;
using System.Web;

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

        protected void ASPxDashboard1_SetInitialDashboardState(object sender, SetInitialDashboardStateEventArgs e) {
            HttpCookie cookie = Request.Cookies["ASPxDashboardState"];
            if (cookie != null) {
                DashboardState dashboardState = new DashboardState();
                if (e.DashboardId == "dashboard1")
                    e.InitialState = dashboardState;

Example 3: Reset a Dashboard State to Default

The code below clears filters (unselects all master filter values), the RangeFilter state and drill-down levels for dashboard items. To do this, assign an empty array of objects to the ItemState.MasterFilterValues, ItemState.DrillDownValues and ItemState.RangeFilterState properties.


The control variable in the example below is the obtained DashboardControl instance. Refer to the Extensions Overview topic for information on how to obtain a DashboardControl for each platform.

function onClick() {
    var state = JSON.parse(control.getDashboardState());
    if (state && state.Items) {
        Object.keys(state.Items).forEach(function (itemName) {
            var itemState = state.Items[itemName];
            itemState.MasterFilterValues = [];
            itemState.DrillDownValues = [];
            itemState.RangeFilterState = { };
  1. For the Pie, Card, Treemap, Gauge and Choropleth Map dashboard items.