Pending Review
Last Updated: 30 Sep 2025 17:32 by Steven
Steven
Created on: 30 Sep 2025 17:32
Category: Reporting
Type: Feature Request
2
WinForm ReportViewer - Add support for injecting IConfiguration

This is related to Ticket ID 1699907.

Currently, the WinForm report viewer fetches configuration (specifically the connection string for any named connection strings defined in reports) directly from appsettings.json, however, it would be useful if the report viewer could take into account an injected IConfiguration since there are scenarios where the configuration may not exist in appsettings.json or a preferred or more up to date user selected value has been added to the configuration from a different source (such as a userSettings.json or secrets.json).

Some background of my use case:

I have a desktop WinForms application targeting .NET 8.0. It usesTelerik.Reporting 19.2.25.813 and Telerik.ReportViewer.WinForms 19.2.25.813 to display reports.

The reports are TRDX files designed with the 64-bit version of "Report Designer".  The report viewer is being displayed in a dedicated WinForm named FrmReport which configures the reportViewer control to use a UriReportSource pointing to the folder on the user's C:\ drive containing the report files. The reports are designed to use a named connection called ReportsConnection which is configured/saved as a shared connection with Alias ReportsConnection in Report Designer.

The default reports connection string is saved in the appsettings.json file.  Upon application startup users select a database connection from a list of saved/remembered connections and the desktop WinForms application saves the user selected ReportsConnection to a configuration file named userSettings.json.  Both appsettings.json and userSettings.json are configured as sources for IConfiguration with reloadOnChange = true.  After a user selects a database connection and the selected connection string is written to userSettings.json, the configuration is reloaded so that the injected IConfiguration from the service container will have the new, user selected value for ReportsConnection.  At this point, IConfiguration has the updated the named ReportsConnection with the desired connection string, which almost always differs from the default one defined in appsettings.json.

However, when loading the reportViewer, the reports unconditionally connect to the server and database defined in the default connection string from appsettings.json, not the user-selected connection string even though the injected IConfiguration has the updated user selected connection string.
0 comments