dashboard-devexpress-dot-dashboardweb-e7a47522.md
Provides data for the ConfigureDataConnection events.
Namespace : DevExpress.DashboardWeb
Assembly : DevExpress.Dashboard.v25.2.Web.dll
NuGet Package : DevExpress.Web.Dashboard.Common
public class ConfigureDataConnectionWebEventArgs :
DashboardConfigureDataConnectionEventArgs
Public Class ConfigureDataConnectionWebEventArgs
Inherits DashboardConfigureDataConnectionEventArgs
ConfigureDataConnectionWebEventArgs is the data class for the following events:
The ConfigureDataConnection events are raised before the connection to a database is established and allows you to customize connection settings. Handle this event to change the parameters required to establish a connection to data (for instance, the server name, the database name, user credentials, the path to a data file, etc). To learn more, see the following topics.
The following code snippet shows how to configure data connections for SQLite, Excel, and OLAP data sources:
private void ASPxDashboard1_ConfigureDataConnection(object sender, ConfigureDataConnectionWebEventArgs e) {
if (e.ConnectionName == "sqliteConnection") {
SQLiteConnectionParameters sqliteParams = new SQLiteConnectionParameters();
sqliteParams.FileName = "file:Data/nwind.db";
e.ConnectionParameters = sqliteParams;
}
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;
}
if (e.DataSourceName == "Excel Data Source") {
ExcelDataSourceConnectionParameters excelParams = new ExcelDataSourceConnectionParameters(HttpContext.Current.Server.MapPath("App_Data/Sales.xlsx"));
e.ConnectionParameters = excelParams;
}
}
Private Sub ASPxDashboard1_ConfigureDataConnection(ByVal sender As Object, ByVal e As ConfigureDataConnectionWebEventArgs)
If e.ConnectionName = "sqliteConnection" Then
Dim sqliteParams As New SQLiteConnectionParameters()
sqliteParams.FileName = "file:Data/nwind.db"
e.ConnectionParameters = sqliteParams
End If
If e.ConnectionName = "olapConnection" Then
Dim olapParams As 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
End If
If e.DataSourceName = "Excel Data Source" Then
Dim excelParams As New ExcelDataSourceConnectionParameters(HttpContext.Current.Server.MapPath("App_Data/Sales.xlsx"))
e.ConnectionParameters = excelParams
End If
End Sub
Object EventArgs ConfigureDataConnectionEventArgs DashboardConfigureDataConnectionEventArgs ConfigureDataConnectionWebEventArgs
See Also