Skip to main content
A newer version of this page is available. .

DashboardDesigner.ConfigureDataConnection Event

Allows you to customize connection settings before the DashboardDesigner connects to a data store (database, OLAP cube, etc.).

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v19.1.Win.dll

Declaration

public event DashboardConfigureDataConnectionEventHandler ConfigureDataConnection

Event Data

The ConfigureDataConnection event's data class is DashboardConfigureDataConnectionEventArgs. The following properties provide information specific to this event:

Property Description
ConnectionName Gets the name of the connection for which the event has been raised. Inherited from ConfigureDataConnectionEventArgs.
ConnectionParameters Gets or sets parameters used to establish a connection to data. Inherited from ConfigureDataConnectionEventArgs.
DataSourceName Gets the data source name for which the event was raised.

Remarks

The ConfigureDataConnection event occurs before connecting to a data source and allows you to customize connection settings.

The event fires when the dashboard is bound to the data sources listed below:

If the dashboard is bound to the DashboardObjectDataSource, the DashboardViewer.DataLoading event fires instead.

To specify connection parameters, you have to cast an object returned by the e.ConnectionParameters property to a proper type, depending on the data source type, as the following table illustrates.

Data Source

Parameter Type

Custom Data Source

To specify a custom connection string, cast an object to the CustomStringConnectionParameters class and assign a custom connection string to the ConnectionString property.

Tip

You can use a custom connection string to get data from an xml file containing valid schema. The string looks as follows: “xpoprovider=InMemoryDataStore;data source=””your_data_file.xml””;read only=True”

SQL Data Source

The base type is the SqlServerConnectionParametersBase class which defines the basic connection parameters: DatabaseName, Password, ServerName and UserName. To specify other data provider parameters, cast an object to any of the following types:

OLAP Data Source

To specify the OLAP connection string, cast an object to the OlapConnectionParameters type and use the ConnectionString property.

Excel Data Source

To specfy a path to a Microsoft Excel workbook/CSV file, cast an object to the ExcelDataSourceConnectionParameters type and use the FileName and Password properties.

Extract Data Source

To specfy a path to a data extract file and a data driver to access the data, cast an object to the ExtractDataSourceConnectionParameters type and use the FileName and DriverName properties.

Entity Framework Data Source

Event does not occur.

Object Data Source

Event does not occur.

Handle the DataLoading event instead.

Example

This code snippet is the ConfigureDataConnection event handler that allows you to specify the extract data source’s file location before the dashboard loads.

Note

The complete sample project How to set master filter in DashboardViewer is available in the DevExpress Examples repository.

using DevExpress.DashboardCommon;
// ...
dashboardViewer1.ConfigureDataConnection += dashboardViewer1_ConfigureDataConnection;
// ...
private void dashboardViewer1_ConfigureDataConnection(object sender, DashboardConfigureDataConnectionEventArgs e)
{
    ExtractDataSourceConnectionParameters parameters = e.ConnectionParameters as ExtractDataSourceConnectionParameters;
    if (parameters != null)
        parameters.FileName = Path.GetFileName(parameters.FileName);
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the ConfigureDataConnection event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also