This example shows how to create an ASP.NET MVC Dashboard Designer application with a set of default data connections.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>@ViewBag.Title</title>
@Html.DevExpress().GetStyleSheets(
new StyleSheet { ExtensionSuite = ExtensionSuite.Dashboard }
)
@Html.DevExpress().GetScripts(
new Script { ExtensionSuite = ExtensionSuite.Dashboard }
)
</head>
<body>
@RenderBody()
</body>
</html>
using System.Web.Mvc;
namespace MVCxDashboard_SimpleDesigner.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
}
<div id="#Dashboard" style="position: absolute; left: 0; right: 0; top:0; bottom:0;">
@Html.DevExpress().Dashboard(settings =>
{
settings.Name = "Dashboard";
settings.Width = Unit.Percentage(100);
settings.Height = Unit.Percentage(100);
}).GetHtml()
</div>
using System.Web.Routing;
using DevExpress.DashboardWeb;
using DevExpress.DashboardWeb.Mvc;
public class DashboardConfig
{
public static void RegisterService(RouteCollection routes)
{
routes.MapDashboardRoute();
DashboardConfigurator.Default.SetDashboardStorage(new DashboardFileStorage(@"~/App_Data/Dashboards"));
}
}
using System;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
namespace MVCxDashboard_SimpleDesigner
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
DashboardConfig.RegisterService(RouteTable.Routes);
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
ModelBinders.Binders.DefaultBinder = new DevExpress.Web.Mvc.DevExpressEditorsBinder();
DevExpress.Web.ASPxWebControl.CallbackError += Application_Error;
}
protected void Application_Error(object sender, EventArgs e)
{
Exception exception = System.Web.HttpContext.Current.Server.GetLastError();
}
}
}
Imports System.Web.Mvc
Namespace MVCxDashboard_SimpleDesigner.Controllers
Public Class HomeController
Inherits Controller
Public Function Index() As ActionResult
Return View()
End Function
End Class
End Namespace
Imports System
Imports System.Web.Http
Imports System.Web.Routing
Imports System.Web.Mvc
Namespace MVCxDashboard_SimpleDesigner
Public Class MvcApplication
Inherits System.Web.HttpApplication
Protected Sub Application_Start()
DashboardConfig.RegisterService(RouteTable.Routes)
AreaRegistration.RegisterAllAreas()
GlobalConfiguration.Configure(AddressOf WebApiConfig.Register)
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters)
RouteConfig.RegisterRoutes(RouteTable.Routes)
ModelBinders.Binders.DefaultBinder = New DevExpress.Web.Mvc.DevExpressEditorsBinder()
AddHandler DevExpress.Web.ASPxWebControl.CallbackError, AddressOf Application_Error
End Sub
Protected Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim exception As Exception = System.Web.HttpContext.Current.Server.GetLastError()
End Sub
End Class
End Namespace
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>@ViewBag.Title</title>
@Html.DevExpress().GetStyleSheets(
new StyleSheet { ExtensionSuite = ExtensionSuite.Dashboard }
)
@Html.DevExpress().GetScripts(
new Script { ExtensionSuite = ExtensionSuite.Dashboard }
)
</head>
<body>
@RenderBody()
</body>
</html>
Imports DevExpress.DashboardWeb
Imports DevExpress.DashboardWeb.Mvc
Imports System.Web.Routing
Public Class DashboardConfig
Public Shared Sub RegisterService(ByVal routes As RouteCollection)
routes.MapDashboardRoute()
DashboardConfigurator.Default.SetDashboardStorage(New DashboardFileStorage("~/App_Data/Dashboards"))
End Sub
End Class
<div id="#Dashboard" style="position: absolute; left: 0; right: 0; top:0; bottom:0;">
@Html.DevExpress().Dashboard(settings =>
{
settings.Name = "Dashboard";
settings.Width = Unit.Percentage(100);
settings.Height = Unit.Percentage(100);
}).GetHtml()
</div>