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

How to display a ReportBook in MVC ?

3 Answers 295 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Seng
Top achievements
Rank 1
Seng asked on 04 Aug 2015, 03:57 PM

Hi,

I'm trying to add reports to a report book and display the report book in a MVC project, but I haven't found a way to do it so far.

Here is the code behind sample

        public ActionResult ReportBook()
        {
            ReportBook reportBook = new ReportBook();
            reportBook.Reports.Add(new TelerikReporting.MissionPlanning());

            Report report = new Report();
            report.DataSource = new UriReportSource() { Uri = "TelerikReporting.AgencyList, TelerikReporting" };
            reportBook.Reports.Add(report);

            InstanceReportSource instanceReportSource = new InstanceReportSource();
            instanceReportSource.ReportDocument = reportBook;

            return View("ReportBook", instanceReportSource);
        }

and the view code

@model Telerik.Reporting.InstanceReportSource

@(Html.TelerikReporting().ReportViewer()

        .Id("reportViewer1")
        .ServiceUrl("/api/reports/")
        .TemplateUrl("/Reports/templates/telerikReportViewerTemplate-9.1.15.624.html")
        .ViewMode(ViewMode.Interactive)
        .ScaleMode(ScaleMode.Specific)
        .Scale(1.0)
        .PersistSession(false)
        .ReportSource(Model)
)

This results in an empty report with a "No Report" message. I don't see what I'm doing wrong, it looks like the few samples I've found.
I've managed to display a single report by using a TypeReportSource instead of an InstanceReportSource, but that's not what I need...

3 Answers, 1 is accepted

Sort by
0
Accepted
Seng
Top achievements
Rank 1
answered on 05 Aug 2015, 09:19 AM
My Google-fu failed me yesterday, I found help in this previous post (http://www.telerik.com/forums/how-to-use-reportbook-with-asp-net-mvc-5)
0
Erwin Yonathan
Top achievements
Rank 1
answered on 15 Jul 2017, 01:38 AM

Good day, how did you solve the problem ?, I have the same problem, I can not display the reportbook in the view, I do not know what value to put in reportSource, this is my code:  $ ("# ReportViewer1")               .telerik_ReportViewer ({                   ServiceUrl: "/ APITelerik / api / Reports /",                   ReportSource: {                       Report: 'I do not know what's going on here'                       Parameters: {                           PackingListId: 32,                       }                   },                   ViewMode: "PRINT_PREVIEW",                   ScaleMode: "ScaleModes.SPECIFIC",                   Scale: "1.0"               });

 

0
Stef
Telerik team
answered on 18 Jul 2017, 01:53 PM
Hi,

The HTML5 Viewer's ReportSource.Report string can be a relative path to a TRDX|TRDP|TRBP file, the assembly qualified name of a report class or custom information you want to handle manually in a custom resolver plugged in the Reporting REST Service.
For more details and examples per viewer, please check How to Set Report SourceS For Report Viewers operating via Telerik Reporting Services.


An example of using a custom resolver to create a ReportBook at run-time is available in ReportBook MVC - Reports with dynamic index to add.

Regards,
Stef
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
Tags
General Discussions
Asked by
Seng
Top achievements
Rank 1
Answers by
Seng
Top achievements
Rank 1
Erwin Yonathan
Top achievements
Rank 1
Stef
Telerik team
Share this question
or