DashboardBuilder.InitialDashboardState(String) Method

Specifies the initial state of the loaded dashboard.

Namespace: DevExpress.DashboardAspNetCore

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

Declaration

public DashboardBuilder InitialDashboardState(
    string initialDashboardState
)
Public Function InitialDashboardState(
    initialDashboardState As String
) As DashboardBuilder

Parameters

Type Name Description
String initialDashboardState

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