How to: Load a Dashboard at Runtime to a Web Viewer


Starting with v17.1, we recommend using the ASPxDashboard control or a corresponding ASP.NET MVC extension to display dashboards within web applications. Refer to the following KB articles to learn more about migration to ASPxDashboard / ASP.NET MVC Dashboard:

The following example demonstrates how to load a dashboard at runtime using the ASPxDashboardViewer.DashboardLoading event.

In this example, the ASPxDashboardViewer.DashboardId property is set at first to introduce a unique dashboard identifier. Then the ASPxDashboardViewer.DashboardLoading event is handled to load the dashboard XML definition. Its DashboardLoadingEventArgs.DashboardId parameter is used to get the identifier of the required dashboard. The DashboardLoadingEventArgs.DashboardXml property is used to specify the dashboard XML definition as a string.

The ASPxDashboardViewer.ConfigureDataConnection event is handled to provide connection settings before the Dashboard Viewer connects to the database. The FileConnectionParametersBase.FileName property is used to set the path to the database file.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" 
         Inherits="Dashboard_DashboardLoading.WebForm1" %>

<%@ Register assembly="DevExpress.Dashboard.v15.1.Web, Version=, 
             Culture=neutral, PublicKeyToken=b88d1754d700e49a" 
             tagprefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">

    <dx:ASPxDashboardViewer ID="ASPxDashboardViewer1" runat="server" 
        Height="800px" Width="1200px">
See Also