How to: Save a Dashboard State to Cookies and Restore this State on the Server Side (MVC)
- 3 min to read
The sample illustrates how to save the current ASP.NET MVC Dashboard 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.
- The DashboardConfigurator.SetDashboardStateService method is used to apply the dashboard state loaded from the cookies.
A complete sample project is available at https://github.com/DevExpress-Examples/aspnet-mvc-dashboard-how-to-save-a-dashboard-state-to-cookies-t589151.
- Index.cshtml (C#)
- Index.cshtml (VB.NET)
Imports System.Web.Mvc Namespace MvcDashboard_DashboardStateCookies.Controllers Public Class HomeController Inherits Controller Public Function Index() As ActionResult Return View() End Function End Class End Namespace