The requested page is not available for the requested platform. You are viewing the content for Default platform.

Register Default Data Connections

  • 3 min to read

This document describes how to provide a Web Dashboard with a set of predefined data connections. These connections will be displayed for end-users in the Dashboard Data Source Wizard when creating new data sources.


You can add a predefined connection in the following ways.

  • Add a connection string specifying a valid connection to the required database to the project's Web.config file as shown below. Note that the connection string should contain the XpoProvider parameter that depends on the used database type.

        <add name="nwindConnection" connectionString="XpoProvider=MSSqlServer; data source=localhost; initial catalog=Northwind; integrated security=SSPI;" />

    To learn how to specify the XpoProvider parameter, see How to Specify a Custom Connection String for an SQL Data Source.

    Note that the Web Dashboard control does not pass connection string names to the client by default. Creating a new data source in the Data Source Wizard raises an exception on an attempt to load connection strings. Pass the ConfigFileConnectionStringsProvider instance as the SetConnectionStringsProvider method's parameter to allow creating new data sources based on connection strings from the Web.config file:

    ASPxDashboard1.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider());

    The Data Source wizard can display not only connection strings contained in the Web.config file but inherited connection strings, too (for instance, connection strings from machine.config). To remove such strings, add the clear element before the application's connection strings.

  • Specify a provider of data connections using the ASPxDashboard.SetConnectionStringsProvider or DashboardConfigurator.SetConnectionStringsProvider method depending on the used server-side API.

    This example shows how to implement a custom provider of connection strings by implementing the IDataSourceWizardConnectionStringsProvider interface.

    using DevExpress.DataAccess.ConnectionParameters;
    using DevExpress.DataAccess.Native;
    using DevExpress.DataAccess.Web;
    // ...
        public class MyDataSourceWizardConnectionStringsProvider : IDataSourceWizardConnectionStringsProvider
            public Dictionary<string, string> GetConnectionDescriptions() {
                Dictionary<string, string> connections = new Dictionary<string, string>();
                // Customize the loaded connections list.  
                connections.Add("msAccessConnection", "MS Access Connection");
                connections.Add("msSqlConnection", "MS SQL Connection");
                return connections;
            public DataConnectionParametersBase GetDataConnectionParameters(string name) {
                // Return custom connection parameters for the custom connection.
                if (name == "msAccessConnection") {
                    return new Access97ConnectionParameters("|DataDirectory|nwind.mdb", "", "");
                } else if (name == "msSqlConnection") { 
                    return new MsSqlConnectionParameters("localhost", "Northwind", "", "", MsSqlAuthorizationType.Windows);
                throw new System.Exception("The connection string is undefined.");

    After you have implemented a custom provider of connection strings, pass the instance of this class to the ASPxDashboard.SetConnectionStringsProvider method.

    using DevExpress.DashboardWeb;
    // ...
    public partial class WebForm1 : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            // ...
            ASPxDashboard1.SetConnectionStringsProvider(new MyDataSourceWizardConnectionStringsProvider());
        // ...