This example shows how to use DashboardOlapDataSource to connect the Web Dashboard to an OLAP cube.
<%@ Page Language="vb" AutoEventWireup="true" CodeBehind="Default.aspx.vb" Inherits="WebDesignerOlapDataSource.Default" %>
<%@ Register Assembly="DevExpress.Dashboard.v16.2.Web, Version=16.2.1.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.DashboardWeb" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="position: absolute; top: 0; left: 0; right: 0; bottom: 0;">
<dx:ASPxDashboard ID="ASPxDashboard1" runat="server" Width="100%" Height="100%"
onconfiguredataconnection="ASPxDashboard1_ConfigureDataConnection">
</dx:ASPxDashboard>
</div>
</form>
</body>
</html>
Imports System
Imports DevExpress.DashboardCommon
Imports DevExpress.DashboardWeb
Imports DevExpress.DataAccess.ConnectionParameters
Namespace WebDesignerOlapDataSource
Partial Public Class [Default]
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim dashboardFileStorage As New DashboardFileStorage("~/App_Data/Dashboards")
ASPxDashboard1.SetDashboardStorage(dashboardFileStorage)
Dim olapDataSource As New DashboardOlapDataSource("OLAP Data Source", "olapConnection")
Dim dataSourceStorage As New DataSourceInMemoryStorage()
dataSourceStorage.RegisterDataSource("olapDataSource", olapDataSource.SaveToXml())
ASPxDashboard1.SetDataSourceStorage(dataSourceStorage)
End Sub
Protected Sub ASPxDashboard1_ConfigureDataConnection(ByVal sender As Object,
ByVal e As ConfigureDataConnectionWebEventArgs)
If e.ConnectionName = "olapConnection" Then
Dim olapParams As New OlapConnectionParameters()
olapParams.ConnectionString = "provider=MSOLAP;" _
& ControlChars.CrLf & _
"data source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;" _
& ControlChars.CrLf & _
"initial catalog=Adventure Works DW Standard Edition;" _
& ControlChars.CrLf & _
"cube name=Adventure Works;"
e.ConnectionParameters = olapParams
End If
End Sub
End Class
End Namespace
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebDesignerOlapDataSource.Default" %>
<%@ Register Assembly="DevExpress.Dashboard.v16.2.Web, Version=16.2.1.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.DashboardWeb" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="position: absolute; top: 0; left: 0; right: 0; bottom: 0;">
<dx:ASPxDashboard ID="ASPxDashboard1" runat="server" Width="100%" Height="100%"
onconfiguredataconnection="ASPxDashboard1_ConfigureDataConnection">
</dx:ASPxDashboard>
</div>
</form>
</body>
</html>
using System;
using DevExpress.DashboardCommon;
using DevExpress.DashboardWeb;
using DevExpress.DataAccess.ConnectionParameters;
namespace WebDesignerOlapDataSource
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DashboardFileStorage dashboardFileStorage = new DashboardFileStorage("~/App_Data/Dashboards");
ASPxDashboard1.SetDashboardStorage(dashboardFileStorage);
DashboardOlapDataSource olapDataSource = new DashboardOlapDataSource("OLAP Data Source", "olapConnection");
DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();
dataSourceStorage.RegisterDataSource("olapDataSource", olapDataSource.SaveToXml());
ASPxDashboard1.SetDataSourceStorage(dataSourceStorage);
}
protected void ASPxDashboard1_ConfigureDataConnection(object sender, ConfigureDataConnectionWebEventArgs e) {
if (e.ConnectionName == "olapConnection") {
OlapConnectionParameters olapParams = new OlapConnectionParameters();
olapParams.ConnectionString = @"Provider=MSOLAP;
Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;
Initial catalog=Adventure Works DW Standard Edition;
Cube name=Adventure Works;
Query Timeout=100;";
e.ConnectionParameters = olapParams;
}
}
}
}