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

DashboardBuilder.InitialDashboardState(String) Method

Specifies the initial state of the loaded dashboard.

Namespace: DevExpress.DashboardAspNetCore

Assembly: DevExpress.Dashboard.v20.2.AspNetCore.dll

NuGet Package: DevExpress.AspNetCore.Dashboard

Declaration

public DashboardBuilder InitialDashboardState(
    string initialDashboardState
)

Parameters

Name Type
initialDashboardState String

Returns

Type Description
DashboardBuilder

A reference to this instance after the operation has completed.

Remarks

Use the InitialDashboardState method to set the identifier of the dashboard to which the state is applied.

To specify the initial dashboard state, initialize the DashboardState object on a server, save this object to JSON using the SaveToJson(DashboardState) method and assign the resulting string to InitialDashboardState.

The following example shows how to load a dashboard with previously selected filter values.

public class HomeController : Controller {
  public IActionResult Index() {
    DashboardState dashboardState = new DashboardState();

    DashboardItemState gridFilterState = new DashboardItemState("gridDashboardItem1");
    gridFilterState.MasterFilterValues.AddRange(new List<object[]>() {
      new string[1] { "Condiments" },
      new string[1] { "Produce" }
    });

    dashboardState.Items.AddRange(new List<DashboardItemState>() {
      gridFilterState, 
    });

    return View(dashboardState);
  }
}
See Also