Back to Devexpress

Create an ASP.NET MVC Dashboard Application

dashboard-116313-get-started-build-web-dashboard-applications-create-an-aspnet-mvc-dashboard-application.md

latest5.3 KB
Original Source

Create an ASP.NET MVC Dashboard Application

  • Mar 07, 2023
  • 4 minutes to read

This tutorial describes how to integrate the ASP.NET MVC Dashboard extension into an ASP.NET MVC web application.

View Example

Create an ASP.NET MVC Application

This section describes how to create an MVC application in the DevExpress Template Gallery.

  1. In Visual Studio, create a new project and select DevExpress v25.2 Web App Template Gallery on the start page as the project template.

  2. In the invoked gallery, go to the ASP.NET MVC category and select Web Application. Enter MvcDashboardApp as a project name and click Run Wizard.

  3. In the opened ASP.NET MVC Project Wizard, select Empty on the Layout tab.

  4. Then, go to the Suites tab and enable only the Dashboard checkbox to attach the Web Dashboard’s stylesheets, scripts, and resources. Click Create Project.

Add a Dashboard Extension to the MVC Application

  1. Build the solution.

  2. Open the Views | Home | Index.cshtml (or Index.vbhtml ) view, right-click the desired location in the Code Editor to display a context menu and click Insert DevExpress MVC Extension… to invoke the Insert DevExpress Extension wizard.

  3. In the Insert DevExpress Extension wizard, go to the Visualization tab, select Dashboard and click Insert.

Create Dashboard Storage

  1. Right-click the App_Data folder and add the Dashboards folder.

  2. In the DashboardConfig.cs file located in the App_Start folder, uncomment the DashboardConfigurator.SetDashboardStorage method call and change the dashboard storage path to ~/App_Data/Dashboards.

Supply Web Dashboard with Data

  1. Add the nwind.mdb file from the following path to the project’s App_Data folder:

  2. Specify a connection string to this database within the project’s Web.config file:

  3. In the DashboardConfig.cs file (located in the App_Start folder), pass the ConfigFileConnectionStringsProvider instance as the DashboardConfigurator.SetConnectionStringsProvider method’s parameter to allow a user to create new data sources based on connection strings from the Web.config file:

Create a Dashboard

  1. The designer application is now ready. Run the project to see the result.

  1. Your application should look as follows:

You can now create your first dashboard in the Web Dashboard.

Switch to Viewer Mode

In Designer mode, the control loads the extensions required to design dashboards. Users can access the Data Source Wizard , preview underlying data, and modify dashboards from storage. Requests from the dashboard backend server can be sent to third-party resources. A user can also switch the control to Viewer mode.

After you created and saved a dashboard, switch your Dashboard Designer application to ViewerOnly mode to prevent users from modifying the dashboard and its data.

  1. In a project, open the Views | Home | Index.cshtml (or Index.vbhtml ) view. Add the following code within the MvcDashboardFactory.Dashboard helper method:

  2. Run the application. The ASP.NET MVC Dashboard extension displays the dashboard from ~/App_Data/Dashboards in Viewer mode:

Next Steps

Create Dashboards on the WebDescribes how to create and configure dashboards in the Web Dashboard control.ASP.NET MVC Dashboard ExtensionContains instructions on how to integrate the DashboardExtension extension into an ASP.NET MVC application. See Also

Web Dashboard Technical Overview

ASP.NET MVC Dashboard Extension

Integrate the Dashboard Extension into a Project