Report Book Pages and Dynamic Removal

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    11 posts
    Member since:
    Apr 2014

    Posted 15 Oct 2014 Link to this post

    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
  2. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 17 Oct 2014 Link to this post

    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.

     
Back to Top