Skip to main content

Prepare Data Source Storage in ASP.NET Web Forms

  • 3 minutes to read

This document describes how to supply a Web Dashboard with a set of predefined data sources that are available for users.

WebDesigner_DefaultDataSources

Create Data Source Storage

Data source storage is a location of settings used to connect the Web Dashboard to data sources. When you register a data source in the storage, you make this data source available for users. You can create one of the following storages:

Predefined storage
Create a DataSourceInMemoryStorage instance as the predefined implementation of an in-memory data source storage. Call the DataSourceInMemoryStorage.RegisterDataSource method to register the specified data source in the current storage.
Custom storage
Implement the IDataSourceStorage interface to create a custom data source storage. You can find one of the implementations in the following topic: Manage Multi-Tenancy.

To register the storage for a Web Dashboard, call the ASPxDashboard.SetDataSourceStorage or DashboardConfigurator.SetDataSourceStorage method and pass the storage you created as the method’s parameter. The selected method depends on the server-side API used in your app.

// Create a data source storage.
DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

// Register an Object data source.
DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("Object Data Source");
objDataSource.DataId = "objectDataSource";
dataSourceStorage.RegisterDataSource("objDataSource", objDataSource.SaveToXml());

// Set the configured data source storage.
ASPxDashboardObjectDS.SetDataSourceStorage(dataSourceStorage);

Register Data Sources

The Web Dashboard supports a wide variety of data sources. Open the article about a specific data source for configuration details:

Tip

Make sure you add the configured data sources to the data storage you use in the Web Dashboard.

Protect User Data

The Web Dashboard saves user credentials used by data sources to the dashboard XML definition.

Use the DashboardConfigurator.PassCredentials property to specify whether to pass this information to the client side (web browser). Set this property to false and specify connection parameters in one of the following ways to avoid any security issues:

Specify connection parameters in Web.config
Add the connection string to the connectionStrings section in the Web.config file and specify the connection parameters.
Create a data connections provider
Implement the IDataSourceWizardConnectionStringsProvider interface to create a data connections provider. Pass the created provider as the ASPxDashboard.SetConnectionStringsProvider or DashboardConfigurator.SetConnectionStringsProvider method’s parameter. The selected method depends on the server-side API used in your app.
Specify the connection parameters at runtime
Handle the ASPxDashboard.ConfigureDataConnection/DashboardConfigurator.ConfigureDataConnection event to specify the connection parameters at runtime.

Example

The example shows how to make a set of data sources available for users in the Web Dashboard application.

web-dashboard-a-list-of-data-sources

View Example: How to Register Data Sources for ASP.NET Web Forms Dashboard Control