ReportViewer has property of the type ReportSource, which does not have connectionstring property, but has parameters
How can I set connection string in runtime for the report that ReportViewer shows?
C# sample will be much appreciated.
1 Answer, 1 is accepted
answered on 12 Dec 2018, 11:56 AM
I have answered the questions raised here in the support ticket you opened on the same topic. For the benefit of our community I will summarize the relevant information also here.
The suggested approach for modifying DataSource connection string run time is to introduce a new Report Parameter in the report definition and assign the value of this parameter to the DataSource.ConnectionString property as explained in the Change Connection String dynamically through a report parameter KB article. The value of the Report Parameter can be passed from the viewer run time, and will be automatically assigned to the DataSource when processing the report.
The Html5 Web Report Viewers exposes a ReportSource that is a client side Report Source, which is different from server side Report Source.
The Html5 Report Viewer client side Report Source has two properties - report and parameters. The report is a string passed to the Report Resolver Resolve() method. The latter should be able to resolve this string to a valid server side Report Source. The values of the parameters in the parameters collection are automatically assigned to the Report Parameters with the same names. Note that client side Report Source properties vary according to the exact Html5 Web Viewer used (i.e. pure, MVC wrapper, Web Forms wrapper and Angular wrapper).
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items