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.
- Dashboard for ASP.NET Core - How to Limit Data Displayed in Designer Mode
- Dashboard for ASP.NET Core - How to Use Parameters to Update a Specific Dashboard Item Without Refreshing the Entire Dashboard
- Dashboard for ASP.NET Core - How to implement authentication
(you will be redirected to DevExpress.com to submit your response)