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

Conditional multi-page report

2 Answers 153 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dustin
Top achievements
Rank 1
Dustin asked on 17 Sep 2013, 05:30 AM
I have a single page report right now. I want to add a report parameter that I can pass in true/false. If the parameter is false, then nothing changes and the report prints as a single page. If the parameter is true, I want the report two print out two pages (the exact same thing from page 1, just twice). 

What do I need to do to get the page to print twice? I'm using the web reporting so setting the print copies to 2 is not an option for me and it has to be done at the report level. 

2 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 19 Sep 2013, 03:55 PM
Hi Dustin,

A possible solution is to override the ReportViewer.PrintReport function as shown in the following code snippet:
<telerik:ReportViewer ID="ReportViewer1" runat="server"  style="border:1px solid #ccc;" width="99%" height="99%"/>
 <script type="text/javascript">
    ReportViewer.prototype.PrintReport = function () {
        var printFrame = document.getElementById("PrintFrame");
        printFrame.src = "Printing.aspx?tmp=" + new Date().getTime();
    }
</script>

After that save the current report source in the ASP.NET session and use it to create one or two instances of your report depending on your business requirements. Add the instances to a ReportBook which you can print after that.

The code and the end result are shown in the attached sample project.

Regards,
Nasko
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

0
Dustin
Top achievements
Rank 1
answered on 19 Sep 2013, 04:01 PM
I figured it out. I copied what I had into another cell and set a conditional on the cell to be visible/not visible based on a  report parameter. 
Tags
General Discussions
Asked by
Dustin
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Dustin
Top achievements
Rank 1
Share this question
or