ConfigureDataConnectionWebEventArgs Class

Provides data for the ConfigureDataConnection events.

Namespace: DevExpress.DashboardWeb

Assembly: DevExpress.Dashboard.v18.1.Web.dll

Declaration

public class ConfigureDataConnectionWebEventArgs :
    DashboardConfigureDataConnectionEventArgs
Public Class ConfigureDataConnectionWebEventArgs
    Inherits DashboardConfigureDataConnectionEventArgs

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.

Examples

This example demonstrates how to customize connection settings before ASPxDashboardViewer connects to a database using the ASPxDashboardViewer.ConfigureDataConnection event.

In this example, the dashboard visualizes data from the secured Microsoft Access database. To visualize data from this database file, it is necessary to provide connection parameters (a path to the database file, a user name and a password for authentication).

using System;
using DevExpress.DashboardWeb;
using DevExpress.DataAccess.ConnectionParameters;

namespace Dashboard_ConfigureDataConnection_Web {
    public partial class WebForm1 : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            string dashboardPath = Server.MapPath("~/App_Data/nwindDashboard.xml");
            ASPxDashboardViewer1.DashboardSource = dashboardPath;
        }

        protected void ASPxDashboardViewer1_ConfigureDataConnection(object sender, 
            ConfigureDataConnectionWebEventArgs e) {
            // Checks the name of the connection for which the event has been raised.
            if (e.DataSourceName == "SQL Data Source 1") {
                // Gets the connection parameters used to establish a connection to the database.
                Access97ConnectionParameters parameters =
                    (Access97ConnectionParameters)e.ConnectionParameters;

                // Specifies the path to a database file.
                string filePath = Server.MapPath("~/App_Data/nwind.mdb");
                parameters.FileName = filePath;

                // Specifies the user name used to access the database file. 
                parameters.UserName = "Admin";

                // Specifies the password used to access the database file.
                parameters.Password = "password";
            }
        }
    }
}

Inheritance

Object
DashboardConfigureDataConnectionEventArgs
ConfigureDataConnectionWebEventArgs

See Also