This is a migrated thread and some comments may be shown as answers.

ReportConnectionStringManager with sub-reports issue

1 Answer 213 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Al
Top achievements
Rank 1
Iron
Iron
Iron
Al asked on 29 Aug 2016, 03:03 PM

Hi,

I am using the code posted here to switch report db at runtime (trdp's designed outside of my application then hosted by http).

http://www.telerik.com/support/kb/reporting/details/changing-the-connection-string-dynamically-according-to-runtime-data

One thing I picked up is that sub-reports are not handled properly, gives an error because the path is not found during this call in 'SetConnectionString' 

subReport.ReportSource = this.UpdateReportSource(subReport.ReportSource);

subReport.ReportSource above will be a simple filename (assuming the sub-report was designed in the same folder as the main report) which means the report file will not be found during deserialization.

I can't post my working routine as it has become too customized but if you're doing this you must ensure that subReport.ReportSource is properly set to a full path before calling UpdateReportSource (or in UpdateReportSource). I hope this helps anyone who has this problem.

 

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 29 Aug 2016, 04:06 PM
Hello Al,

When you design the report, the sub report may be specified by relative path. Relative paths are resolved based on the running application.

Thus you will have to get the relative path (UriReportsource.Uri string) and resolve it depending on the current application. If it is a web application, you can use Server.MapPath to get the actual path to the file.

Regards,
Stef
Telerik by Progress
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? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Al
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Stef
Telerik team
Share this question
or