Current filter:
                                You should refresh the page.
                                  • UPD.  Starting from v19.1, the Web Dashboard Viewer is not included in our installation packages and its API is removed from our source code. See Migrate from Web Viewer to Web Dashboard in ASP.NET MVC for the actual information on how to migrate to the Web Dashboard Control.

                                    In v17.1 we put the old DashboardViewerExtension into maintenance mode and highly recommend using DashboardExtension in the ViewerOnly mode instead.
                                    To learn more about preparing an application with DashboardExtension, see ASP.NET MVC Dashboard Extension.
                                    Take into account the following changes when migrating to the MVC Dashboard:

                                    1. Attaching JavaScript Libraries
                                    The MVC Dashboard control requires additional client-side libraries along with MVC Viewer scripts:
                                         - jQuery UI 1.12.1+
                                         - knockout 3.4.0+
                                         - ace.js
                                    If you have included libraries for the MVC Viewer by adding the "Resources" section to the application's Web.config file, all required scripts are added automatically.
                                    To include the required scripts manually, attach the jQuery UI,Knockout,   and Ace libraries to the web page in addition to the scripts used by MVC Viewer. The MVC Dashboard also requires the jQuery 3.3.1+  script. Thus, make sure that you are using the actual version of jQuery:

                                    To learn more about required third-party scripts, see Required Client Libraries.

                                    To attach the Dashboard Javascript file, change the ExtensionsFactory.GetScripts method's parameters: use the ExtensionSuite.Dashboard value instead of ExtensionSuite.DashboardViewer.

                                            // ...  
                                            new Script { ExtensionSuite = ExtensionSuite.DashboardViewer }  


                                            // ...  
                                            new Script { ExtensionSuite = ExtensionSuite.Dashboard }  

                                    To learn more, see the Attach the Required JavaScript Files section.

                                    2. Attaching the Required Style Sheets
                                    You need to to attach the required style sheets for the Dashboard Extension. For this, change the the ExtensionsFactory.GetStyleSheets extension method's parameters: use the ExtensionSuite.Dashboard value instead of ExtensionSuite.DashboardViewer.

                                    <head> ... @Html.DevExpress().GetStyleSheets( // ... new StyleSheet { ExtensionSuite = ExtensionSuite.DashboardViewer } ) ... </head>


                                    <head> ... @Html.DevExpress().GetStyleSheets( // ... new StyleSheet { ExtensionSuite = ExtensionSuite.Dashboard } ) ... </head>

                                    To learn more, see the Attach the Required Style Sheets section.

                                    3. Adding Route Definition
                                    Call the MapDashboardRoute method to add the MVC Dashboard's route. The code snippet below shows how to add the required code to the RouteConfig.cs file.

                                    using DevExpress.DashboardWeb.Mvc; // ... public static void RegisterRoutes(RouteCollection routes) { // ... RouteTable.Routes.MapDashboardRoute(); // ... }

                                    4. Adding Extension Code
                                    To use the Dashboard in ASP.NET MVC, utilize the DashboardExtension class. To add a Dashboard extension to a View, call the MvcDashboardFactory.Dashboard helper method instead of  MvcDashboardFactory.DashboardViewer. This method provides a parameter that returns the DashboardExtensionSettings. Use these settings to set the DashboardExtensionSettings.WorkingMode property to ViewerOnly value.

                                    @model DevExpress.DashboardWeb.Mvc.DashboardSourceModel @Html.DevExpress().DashboardViewer(settings => { settings.Name = "DashboardViewer"; settings.AllowExportDashboard = true; settings.CallbackRouteValues = new { Controller = "Home", Action = "DashboardViewerPartial" }; settings.ExportRouteValues = new { Controller = "Home", Action = "DashboardViewerPartialExport" }; }).BindToSource(Model).GetHtml()


                                    @Html.DevExpress().Dashboard(settings => { settings.Name = "Dashboard"; settings.AllowExportDashboard = true; settings.WorkingMode = DevExpress.DashboardWeb.WorkingMode.ViewerOnly; }).GetHtml()

                                    MVC Dashboard sends requests to the internal DashboardController and routing is adjusted only once using the MapDashboardRoute method. As a result, you can include the MVC Dashboard to any place of your application and it is not necessary to create a separate partial View for it.

                                    5. Adding Controller Code
                                    Previously, it was necessary to use the Controller.PartialView(String) method to render a Partial View with the MVC Viewer and pass a model to the View:

                                    public ActionResult DashboardViewerPartial() { return PartialView("_DashboardViewerPartial", DashboardViewerSettings.Model); }

                                    6. Providing Dashboards
                                    The Dashboard source model is not used anymore to provide dashboards. You need to create the dashboard storage instead.
                                    This part of code is not required and you can delete it from the HomeController.cs file:

                                    class DashboardViewerSettings { public static DashboardSourceModel Model { get { return DashboardSourceModel(); } } private static DashboardSourceModel DashboardSourceModel() { DashboardSourceModel model = new DashboardSourceModel(); model.DashboardSource = System.Web.Hosting.HostingEnvironment.MapPath(@"~\File1.xml"); return model; } }

                                    To provide dashboards, create storage and register the dashboard in it. The code below demonstrates how to create the default In-Memory storage in the Global.asax file and register a dashboard:

                                    using DevExpress.DashboardWeb; // ... public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { // ... DashboardInMemoryStorage storage = new DashboardInMemoryStorage(); DashboardConfigurator.Default.SetDashboardStorage(storage); storage.RegisterDashboard("dashboard1", XDocument.Load(System.Web.Hosting.HostingEnvironment.MapPath(@"~\File1.xml"))); } // ... }

                                    To learn more about different types of dashboard storages, see Preparing a Dashboard Storage.

                                    7. Providing Data
                                    The Dashboard source model is not used anymore to provide data. You need to use the DashboardConfigurator instead.
                                         - Use the DashboardConfigurator.ConfigureDataConnection event to customize connection settings before the MVC Dashboard connects to a data store (database, OLAP cube, etc.).
                                         - To include WHERE clauses in SQL queries, use the DashboardConfigurator.CustomFilterExpression event.
                                         - Use the DashboardConfigurator.DataLoading event to provide data for a data source assigned in code.

                                    8. Reloading Data
                                    In the MVC Viewer, the ASPxClientDashboardViewer.ReloadData method is used to reload data in all dashboard data sources. In the MVC Dashboard, we change the model of using data, and data is reloaded automatically. You can set the data reloading timeout in the MVC Dashboard by handling the DashboardConfigurator.ConfigureDataReloadingTimeout event. However, it is also possible to refresh data manually by calling the ASPxClientDashboard.ReloadData method (available starting with v18.2). To learn more about the MVC Dashboard's caching mechanism, refer to the T520250: Web Dashboard - How to manage an in-memory data cache when the Client data processing is used KB article.

                                    9. Security

                                    When migrating from MVC Viewer to MVC Dashboard, it is necessary to take into account the following MVC Dashboard specifics related to security:
                                         - MVC Dashboard does not load dashboards with custom SQL queries by default. To learn how to enable this functionality, refer to the Custom SQL Queries article.
                                         -  If the working mode is set to WorkingMode.Viewer and you are using DashboardConfigurator's server-side API, handle the DashboardConfigurator.VerifyClientTrustLevel event to verify the trust level used to specify which actions a client can initiate to execute them on the server.
                                         -  For security reasons, the MVC Dashboard control automatically checks whether a dashboard contains data connection parameters. In this case, the dashboard will not be loaded. Refer to the T453795 - How to protect parameters used to establish a connection to data when the Web/MVC Dashboard is used ticket to learn how to protect parameters used to establish a connection to data when the MVC Dashboard is used.
                                    For more details on security in MVC Dashboard, see Security Considerations.

                                    10. Appearance
                                    The MVC Dashboard control supports the same set of themes as MVCxDashboardViewer:
                                        - ASPxDashboard.ColorSchemeLight
                                        - ASPxDashboard.ColorSchemeLightCompact
                                        - ASPxDashboard.ColorSchemeDark
                                        - ASPxDashboard.ColorSchemeDarkCompact
                                    To learn more about appearance, see Appearance Customization.
                                    Note that compact themes are available starting with v17.1.6.

                                    11. Client-Side API
                                    The MVC Dashboard control uses a similar client-side API (for exporting, coloring, requesting parameter values, etc.) as the MVC Viewer except for the following differences:
                                      - Master Filtering
                                        1) When filtering is applied, or the state of the master filter item changes, the client ASPxClientDashboard.ItemMasterFilterStateChanged event is raised instead of ASPxClientDashboardViewer.MasterFilterSet. Use the DashboardControlClientSideEvents.ItemMasterFilterStateChanged property to provide JavaScript code that will handle this event.
                                        2) When an end-user clears the selection in the master filter item, the client ASPxClientDashboard.ItemMasterFilterStateChanged event is raised again instead of ASPxClientDashboardViewer.MasterFilterCleared.
                                      - Drill-Down
                                        1) After drill-down (or drill-up) is performed, the client ASPxClientDashboard.ItemDrillDownStateChanged event is raised instead of ASPxClientDashboardViewer.DrillDownPerformed (or ASPxClientDashboardViewer.DrillUpPerformed). Use the DashboardControlClientSideEvents.ItemDrillDownStateChanged property to provide JavaScript code that will handle this event.
                                    To learn general information about client-side customization, see Client-Side Functionality Overview and MVC Dashboard - Client-Side API Overview articles.

                                    - Cannot find the DashboardLoaded event in the MVC Dashboard.
                                    In the MVC Dashboard extension, it is necessary to define a custom Dashboard Storage and override the LoadDashboard  method that is used to load dashboards. From this method, you can edit the loaded dashboard and provide the updated version to the MVC Dashboard control.
                                    For instance, see the code below:

                                    public class MyDashboardFileStorage : DashboardFileStorage { public MyDashboardFileStorage(string workingDirectory) : base(workingDirectory) { } protected override XDocument LoadDashboard(string dashboardID) { var doc = base.LoadDashboard(dashboardID); if (dashboardID == "Dashboard1") { Dashboard dashboard = new Dashboard(); dashboard.LoadFromXDocument(doc); //Customize Dashboard //... return dashboard.SaveToXDocument(); } } }

                                    To see this approach in action, refer to the How to customize a dashboard before displaying it in a browser code example.

                                    - Dashboard is not loaded.
                                    It can occur due to security reasons. Note that the MVC Dashboard control automatically checks whether a dashboard contains data connection parameters. In this case, the dashboard will not be loaded. To learn how to protect parameters used to establish a connection to data when the MVC Dashboard is used, refer to the T453795 ticket.

                                    - Cannot find the FilterElementDefaultValues event in the MVC Dashboard.
                                    The MVC Dashboard control provides the IDashboardStateService service that allows specifying values of parameters and filter elements and other state parameters at one. To learn more about a dashboard state, see Manage Dashboard State.

                                    See Also
                                    How to migrate from ASPxDashboardViewer to ASPxDashboard working in the ViewerOnly mode
                                    Web Dashboard Documentation

                                0 Solutions

                                Creation Date Importance Sort by