Skip to main content Skip to footer

How to Use SubReports in Page Reports

Quick Start Guide
What You Will Need ActiveReports.NET
Controls Referenced

Subreport

Parameters

Overflow Placeholder

Tutorial Concept This tutorial walks you through enhancing a Page Report by embedding a SubReport control to display detailed child reports within a larger report template. You’ll learn how to pass parameters between the main and subreport, and configure overflow handling with placeholders to ensure your reports render cleanly and consistently across pages.

When building complex reports, it’s often helpful to break content into smaller, reusable components. SubReports allow you to embed one report inside another, making it easier to organize detailed data, reuse existing report designs, and keep your layouts consistent. In this guide, we’ll explore how to incorporate SubReports into Page Reports, pass parameters between the main and child reports, and handle overflow so your report remains both flexible and polished.

Download the sample rdlx files

In this blog, we’ll create an invoice using two reports. The main report functions much like a template and includes the company logo, date, address, and a payment stub to be returned with the payment. We’ll use a SubReport control to include the details of the customer’s purchase. By using a SubReport in this scenario, the template can easily be re-used for other purposes.

Create your own invoice with these 5 steps:

1. Creating the Template

2. Add a SubReport Control

3. Pass a Parameter

4. Account for Overflow

5. Preview the Page Report with Subreports

Ready to Get Started with ActiveReports? Download Our Free Trial Today!

Step 1. Creating the Template

We want to create a template that looks something like this:

Invoice with SubReports

First, let's create a Page Report in the ActiveReports designer. Choose the designer that fits your needs best with our Standalone Designer, Visual Studio Integrated Designer, and End User Designer. In this example I will be using the Standalone Designer, but the process will look very similar regardless of which you choose.

In the Report Explorer, add a Data Source to connect to the Reels Database, and then add a “Customers_List” Data Set to bring in our desired fields.

Download the Reels Sample Database Here!

Add the data source in the report explorer

Add the company logo as an embedded image.

Next, from the ToolBox, place an Image control, a series of TextBoxes, and Containers in the top portion of the page on the design surface. Use the Field Selection Adorners to bind each TextBox to a field in our Customers_List data set.

For the Payment Stub portion, place a container control at the bottom of the page. Inside the container, place our logo and a series of TextBoxes for our address, the customer’s address, account number, etc. Again, bind the TextBoxes to the respective fields from our data set, and adjust their sizes.

Step 2. Add a SubReport Control

From the ToolBox, drag a SubReport control and drop it in the middle of the page. We’ll resize it to an appropriate height and width within the page. This SubReport control will be used to bring in another report that details the customer’s purchases. This ‘child’ report has a tabular layout:

Subreport layout

We need to bind the SubReport control to the child report using the “ReportName” property of the SubReport control in the Properties window. Here, we can select a report file from the file directory

Step 3. Pass a Parameter

To ensure that the child report lists the right customer’s purchase order in the template, we need to pass a parameter from the template to the child report. This parameter is the “SaleID” for the particular sale for which we're creating the statement.

First, add a hidden parameter in the child report named “SalesID”, and then modify the query in the child report to filter the data based on the parameter being passed.

Next, go back to the template report and select the SubReport control. In the Properties window, click on the ellipses next to “Parameters”. In the resulting “Subreport – Parameters” dialog box, add a parameter and set its value to the SaleID field from our Customers_List data set.

Parameters

NOTE: It's important to ensure that the Parameter Name here matches the name given to the parameter in the child report.

Step 4. Account for Overflow

The last step is to account for cases where the purchase order exceeds the allotted space of the SubReport control. In these cases, because the SubReport control cannot grow, the child report would be cut short and some rows wouldn't display.

To account for these scenarios, add a second page to the template where we can show the overflow from the SubReport control. At the bottom of the designer window, click on “New” to create a new page:

Create a new page

On Page 2, drag an OverflowPlaceHolder control from the ToolBox and stretch it to fill the page. Rename the OverflowPlaceHolder control to SubReportOverFlow. Next, click on the white margins of the page to select Page 2, and, in the Properties window, set ThrowIfPlaceHoldersEmpty to true. This discards a blank, or empty, page 2 if the child report doesn't need to overflow to page 2.

Now, we connect the SubReport control to the OverflowPlaceHolder control so the SubReport knows where to go to display the extra content. Select the SubReport control, and, in the Properties window, set the OverflowName Property to SubReportOverFlow.

Step 5. Preview the Page Report with Subreport

At this point, we’re done. On Preview, our report should look like this:

Page report with subreport

Congratulations, you have just made an invoice with SubReports!

By incorporating SubReports into your Page Reports, you can simplify report design, improve reusability, and maintain a consistent structure across multiple outputs. With parameter mapping and overflow handling in place, your reports can display detailed child content seamlessly without compromising layout or readability. SubReports are a powerful way to keep complex reporting scenarios organized and efficient, ensuring both developers and end users get clear, well-structured results.

Ready to Get Started with ActiveReports? Download Our Free Trial Today!

 

comments powered by Disqus