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

Report Viewer Not Displaying Instance Report Source

2 Answers 1037 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Darren
Top achievements
Rank 1
Darren asked on 02 May 2019, 07:49 PM

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 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 07 May 2019, 12:55 PM
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

0
Darren
Top achievements
Rank 1
answered on 07 May 2019, 03:26 PM

Hi Neli,

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

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