IReportResolver and print/save with Silverlight Viewer

2 posts, 0 answers
  1. David Tosi
    David Tosi avatar
    3 posts
    Member since:
    Nov 2005

    Posted 21 Mar 2013 Link to this post


    I am using Telerik Reporting version Q1 2013 build with the Silverlight viewer. I have implemented the IReportResolver interface to be able to pass custom parameters to reporting service. The primary reason for this is to support custom trdx reports and I need to know what report to create so I cannot pass this information to my custom report class. In the past I was able to do this with the report parameters but this was changed to be initialized after the report is created. So my solution was to use the custom IReportResolver which works great when viewing the report, but when I try to print the report, the path to the report appears to be falling back to the full class and assembly name, instead of my custom report path. Is there any way to get the printing and saving methods from the Silverlight control to pass the custom report path and not the fully qualified assembly/class path? I have verified that the custom report path is set correctly in the Report parameter of the ReportViewer control.

    David Tosi
  2. Peter
    Peter avatar
    1629 posts

    Posted 26 Mar 2013 Link to this post

    Hello David,

    As you have noticed the service makes subsequent request to the ReportResolver for export and refresh operations. Thus when you are deserializing the XML report definition to Telerik.Reporting.Report and returning an InstanceReportSource it's expected the subsequent calls to the resolver to be with this type. In order to avoid this unexpected behavior our recommendation is to return an UriReportSource and cache temporary trdx definitions for usage in the subsequent requests as shown in the following code snippet sample:

    public ReportSource Resolve(string fullPath)
            new Uri(fullPath);
            return new UriReportSource
                Uri = fullPath
        catch (UriFormatException) { }
        var settings = new System.Xml.XmlReaderSettings();
        settings.IgnoreWhitespace = true;
        using (var fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read))
            var xmlSerializer = new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
            var report = (Report)xmlSerializer.Deserialize(fileStream);
                    ConnectionString.GetOracleConnectionString(), report);
            var reportFilePath = MapPath("report" + Guid.NewGuid() + ".xml");
            using (var tempFileStream = new FileStream(reportFilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite))
                using (var xmlWriter = System.Xml.XmlWriter.Create(tempFileStream))
                    xmlSerializer.Serialize(xmlWriter, report);
            return new UriReportSource
                Uri = reportFilePath

    Generally it's in our plans to enable the custom IReportResolver implementations to work directly with all of the available report sources.

    Kind regards,
    the Telerik team

    Telerik Reporting Q1 2013 available for download with impressive new visualizations. Download today from your account.

Back to Top