Report Book for HTML5 WebForms Report Viewer

0 Answers 127 Views
Report Book Report Viewer - HTML5 WebForms
Adrian
Top achievements
Rank 1
Adrian asked on 05 Nov 2021, 11:26 AM | edited on 05 Nov 2021, 11:29 AM

I'm using HTML5 Webforms Report Viewer, and I want to create multiple instances of the same report using the ReportBook. Here are my codes:

var myReportSource = new Telerik.ReportViewer.Html5.WebForms.ReportSource();

myReportSource.IdentifierType = IdentifierType.TypeReportSource;

myReportSource.Identifier = typeof(myReport).AssemblyQualifiedName;

ReportBook reportBook = new ReportBook();

for (int i=0; i < jsonObject.Count; i++)

{

        reportBook.Reports.Add(new MyReport());

        reportBook.Reports[i].ReportParameters["Field"].Value = jsonObject[i]["Field"];

}

ReportViewer.ReportSource = myReportSource;

Question:

1. How do I assign the Report Book to the report source, then to be assigned to the report viewer? 

2. How do I set the "Mergeable" property to "false" for the report parameters?

Note: 

I have tried the approach from https://www.telerik.com/forums/two-of-same-report-in-one-reportbook-different-parameters, but I got an error "Cannot Implicitly Convert type InstanceReportSource to Html5.WebForms.ReportSource

Neli
Telerik team
commented on 10 Nov 2021, 11:22 AM

Hi Adrian,

You need to implement a CustomReportSourceResovler. In the resolve method, you need to create the report book. Note that you have to assign the report book to an InstsanceReportSource.  Please, find more details in the How to display a report via InstanceReportSource in the HTML5 Viewer KB article.

You can change the Mergeable property from the report parameter properties, or you can change it in the code.

No answers yet. Maybe you can help?

Tags
Report Book Report Viewer - HTML5 WebForms
Asked by
Adrian
Top achievements
Rank 1
Share this question
or