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.2.Win.dll

Declaration

public event DashboardConfigureDataConnectionEventHandler ConfigureDataConnection
Public Event ConfigureDataConnection As DashboardConfigureDataConnectionEventHandler

Event Data

The ConfigureDataConnection event handler receives an argument of the DashboardConfigureDataConnectionEventArgs type. 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.
ConnectionParameters Gets or sets parameters used to establish a connection to data.
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.

This event is raised when the dashboard is supplied with data using one of the following data source types:

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

To specify connection parameters, cast an object the e.ConnectionParameters property returns to the DataConnectionParametersBase descendant. The following table lists the different data sources and their corresponding descendants:

Data Source

Parameter Type

Custom Data Source

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 that contains valid schema, for example, "xpoprovider=InMemoryDataStore;data source=""your_data_file.xml"";read only=True"

SQL Data Source

The SqlServerConnectionParametersBase class is the base type and 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

Cast an object to the OlapConnectionParameters type and use the ConnectionString property.

Excel Data Source

Cast an object to the ExcelDataSourceConnectionParameters type and use the FileName and Password properties.

Extract Data Source

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/AsyncDataLoading event instead:

JSON Data Source

Cast an object to the JsonSourceConnectionParameters type and use the JsonSource property.

Examples

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