ASPxClientDashboard.DashboardStateChanged Event
Occurs after the state of the dashboard displayed in the ASPxClientDashboard is changed.
Namespace: DevExpress.DashboardWeb.Scripts
Assembly: DevExpress.Dashboard.v18.2.Web.WebForms.Scripts.dll
Declaration
Event Data
The DashboardStateChanged event's data class is ASPxClientDashboardStateChangedEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
DashboardState | Gets the current state of the dashboard. |
Remarks
To learn more about a dashboard state, see Manage Dashboard State.
Example
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:
- The
ASPxClientDashboard.DashboardStateChanged
event is handled to obtain the current dashboard state. - The ASPxClientUtils.SetCookie client-side method is used to save the dashboard state to cookies.
- In the ASPxDashboard.SetInitialDashboardState event handler, the dashboard state is loaded from the cookies and applied to a dashboard.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/aspxdashboard-how-to-save-a-dashboard-state-to-cookies-t513329.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="WebDashboard_DashboardStateCookies.Default" %>
<%@ Register Assembly="DevExpress.Dashboard.v17.1.Web, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.DashboardWeb" TagPrefix="dx" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="position:absolute; left:0; right:0; top:0; bottom:0;">
<dx:ASPxDashboard ID="ASPxDashboard1" runat="server"
WorkingMode="ViewerOnly"
ClientInstanceName="webDashboard"
IncludeDashboardIdToUrl="True"
DashboardStorageFolder="~/App_Data/Dashboards"
Height="100%" Width="100%" OnSetInitialDashboardState="ASPxDashboard1_SetInitialDashboardState">
<ClientSideEvents DashboardStateChanged="
function(s, e) {
var cookies = e.DashboardState;
ASPxClientUtils.SetCookie('ASPxDashboardState', cookies);
}"></ClientSideEvents>
</dx:ASPxDashboard>
</div>
</form>
</body>
</html>