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

Report Book Pages and Dynamic Removal

1 Answer 136 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 15 Oct 2014, 04:03 PM
I have a question concerning the removal of a page from a reportbook at runtime.

I have a custom reportbook class that is defined as a set of report pages.

public class MyReportBook : ReportBook
{
    public MyReportBook()
    {
        this.Reports.Add(new CoverPage());
        this.Reports.Add(new DetailPage());
        this.Reports.Add(new SummaryPage());
        this.Reports.Add(new MonthlyBreakoutPage());
    }
}


Now, for a subset of my objects, no summary page is required, so I'd like to, based on a condition in the bound data object, programatically delete it from the book. 

I've gotten the desired results by creating another reportbook class and removing the pages that I don't want, but given that the Reports for the 3 of the 4 pages are the exact same and all I want to do is remove a page, is there a way to do this?

Thanks

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 17 Oct 2014, 03:48 PM
Hello Jonathan,

You can use a parameterized constructor to create the ReportBook, and pass a flag determining if the SummaryPage report should be added.

The created instance can be passed to the viewer/ReportProcessor via an InstanceReportSource.

In the case of the HTML5 Report Viewer, you will need a custom report resolver for the Reporting REST Service. In the resolver's Resolve method you will receive a string information sent by the client (viewer) through the viewer's reportSource.report. Based on that string you can determine which report to display and additionally modify it before returning a report source object.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

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