Skip to main content

ConfigureDataConnectionWebEventArgs Class

Provides data for the ConfigureDataConnection events.

Namespace: DevExpress.DashboardWeb

Assembly: DevExpress.Dashboard.v24.2.Web.dll

Declaration

public class ConfigureDataConnectionWebEventArgs :
    DashboardConfigureDataConnectionEventArgs

Remarks

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.

Example

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;
    }
}
See Also