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

Transfert information from the ReportViewer to the Reporting service

1 Answer 41 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Etienne
Top achievements
Rank 1
Etienne asked on 28 Jun 2013, 01:56 PM
I am working a on Silverlight solution using the ReportViewer and a subclass of Telerik.Reporting.Service.ReportService for the reporting service.

The report to be produce is about the same, every time, but I needed a way to provide some "parameters" from the client to the service in order to customize the report before generation.

I used the "ReportViewer.Report" property on the client side and a custom IReportResolver on the server side to transfert my information on the service side. This way, my custom IReportResolver could parse the information, instantiate and customize the report before generation.

Example:
Silverlight:
<tkr:ReportViewer  ReportServerUri="../ReportingService.svc" Report="param1=X;param2=Y;etc" />


Service:
public class MyReportingService : ReportService, IReportResolver
{
 
    public MyReportingService ()
    {
      this.ReportResolver = this;
    }
 
    ReportSource IReportResolver.Resolve( string report )
    {
      var myReport = new MyReport();
      // Here I customize the "myReport" instance based on the
      // value of the "report" parameter
      return new InstanceReportSource() { ReportDocument = myReport };
    }
}

Everything work as expected when displayed in the ReportViewer, but when the user click the "save as" button, the "ReportViewer.Report" property value is NOT the one provided to the IReportResolver. The fully qualified name of the Report class is used instead.

Do you have any suggestions to workaround this issue ?

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 01 Jul 2013, 01:05 PM
Hello Etienne,

When using custom IReportResolver, there is a little peculiarity. The first time a report is loaded the value from the Report property is send (the name of the expected report). However subsequent calls made by the viewer from a functionality like the print will call this method with a different parameter, depending on what ReportSource you have returned. If for example you return an InstanceReportSource and click print/export, the report parameter will be the assembly qualified name of the report that you have previously returned as ReportSource. If you return an UriReportSource, the print/export will call it with an Uri string. If you rework your Resolver method having that in mind, should fix your issues. 

You may find useful the IReportResolver and print/save with Silverlight Viewer forum thread.

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

Tags
General Discussions
Asked by
Etienne
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or