DashboardBuilder.InitialDashboardState(String) Method
Specifies the initial state of the loaded dashboard.
Namespace: DevExpress.DashboardAspNetCore
Assembly: DevExpress.Dashboard.v24.2.AspNetCore.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
initialDashboardState | String | A string that defines the initial dashboard state. |
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.
Example
The sample illustrates how to specify a dashboard state (such as a 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 defined in the Controller stores the dashboard state. The MVC approach is used to pass the specified dashboard state to the View’s DashboardBuilder.InitialDashboardState property and use this state when loading a dashboard.
@model DevExpress.DashboardCommon.DashboardState
<div style="position: absolute; left:0;top:0;right:0;bottom:0;">
@(Html.DevExpress().Dashboard("clientDashboardDesigner1")
.ControllerName("DefaultDashboard")
.Width("100%")
.Height("100%")
.WorkingMode(WorkingMode.Viewer)
.InitialDashboardState(Model.SaveToJson())
.Extensions(extension => extension.UrlState(state => state.IncludeDashboardStateToUrl(true)))
)
</div>