Report Viewer Not Displaying Instance Report Source

3 posts, 0 answers
  1. Clint
    Clint avatar
    2 posts
    Member since:
    Feb 2019

    Posted 02 May Link to this post

    I am trying to set up the report viewer to display a report using the InstanceReportSource. I want to use the InstanceReportSource because our application programmatically renders, compresses and downloads mass reports. I have followed this guide and have set up the rest service and custom resolver. I am using the same code to create the reports for rendering/downloading and for passing to the report viewer. The rendering and downloading works just fine but the report viewer is blank. During debugging, I can see the Reports API controller being hit and the resolver creating the InstanceReportSource.

    I have created a a sample application that shows how I am using the reporting service. I'm sure that I'm missing something minor. I just can't figure out what. Any help would be much appreciated.

    Sample Application Download

  2. Neli
    Admin
    Neli avatar
    49 posts

    Posted 07 May Link to this post

    Hi Clint,

    Thank you for providing a runnable project.
    The problem comes from a small error in the initialization of the report viewer-> the Id was wrong. Instead of "reportViewer", it should be "reportViewer1". The Id of the viewer should be the same in the initialization and in the section styles.
    You also need to add the following links for the style of the viewer:


    Eventually, the Report.cshtml page should look in the following way:

    @model int?
    @using Telerik.ReportViewer.Mvc
    @{
        ViewBag.Title = "Report";
    }
     
     
     
    @section styles
    {
        <style>
            #reportViewer1 {
                position: absolute;
                left: 5px;
                right: 5px;
                top: 40px;
                bottom: 5px;
                overflow: hidden;
                clear: both;
            }
        </style>
    }
     
    <h2>Report</h2>
     
     
     
    @(Html.TelerikReporting().ReportViewer()
                            .Id("reportViewer1")
                            .ServiceUrl(Url.Content("~/api/reports/"))
                            .ReportSource(Model.ToString())
                            .ViewMode(ViewMode.Interactive)
                            .ScaleMode(ScaleMode.Specific)
                            .Scale(1.0)
                            .PersistSession(false)
                            .PrintMode(PrintMode.ForcePDFFile)
                            .EnableAccessibility(false)
                            .SearchMetadataOnDemand(false)
                            .SendEmail(new SendEmail { Enabled = false })
                            .Deferred()
    )
     
    @section scripts {
        @(Scripts.Render("~/bundles/reporting"))
     
        @(Html.TelerikReporting().DeferredScripts(true))
    }


    I hope this would fix the problem also on your side.
    If you need further assistance do not hesitate to ask.

    Regards,
    Neli
    Progress Telerik
    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

  3. Clint
    Clint avatar
    2 posts
    Member since:
    Feb 2019

    Posted 07 May in reply to Neli Link to this post

    Hi Neli,

    Your suggestions resolved my problem! Thanks a lot for your help!

Back to Top