The example shows how to switch between database connections from the Web Dasard UI. To implement conditional logic for the Web Dasard 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 DasardControl.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 DasardConfigurator.ConfigureDataConnection event handler. The CustomStringConnectionParameters class instance is used to initialize and apply a custom connection string.
- Dasard for ASP.NET Core - How to Limit Data Displayed in Designer Mode
- Dasard for ASP.NET Core - How to Use Parameters to Update a Specific Dasard Item Without Refreshing the Entire Dasard
- Dasard for ASP.NET Core - How to implement authentication
(you will be redirected to DevExpress.com to submit your response)