Skip to content

Switch between database connections from the Web Dashboard UI in an ASP.NET Core application

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/asp-net-core-dashboard-change-database-connection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BI Dashboard for ASP.NET Core - How to Change the Database Connection from the Web Dashboard UI

The example shows how to switch between database connections from the Web Dashboard UI. To implement conditional logic for the Web Dashboard Control, pass custom headers from the client to the server.

To switch between databases from the UI, add buttons corresponding to databases to the Designer Toolbar. Use the preparing event to customize the existing items in the Designer Toolbar. When a button is clicked, a custom header with the corresponding database name (nwind/nwind2) is passed with the fetchRemoteService.headers option. After that, the DashboardControl.reloadData method is called to reload the data. See the customizeToolbar.js file for implementation details.

On the server, the IHttpContextAccessor is used to access the passed parameter value (database name) in the DashboardConfigurator.ConfigureDataConnection event handler. The CustomStringConnectionParameters class instance is used to initialize and apply a custom connection string.

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)