Telerik Reporting

The SubReport report item lets you display one report within another report. It is a container item just like the report sections and grows depending on its children. The screenshot shows a SubReport report item at design-time. This allows you to compose complex reports from disparate report sources. The data for each SubReport can be completely different. For example you could combine a product listing, a sales summary and a list of sales people each in their own sub reports, with each sub report getting data from a different source. You can also pass parameters to SubReports using the Edit Parameters collection editor.

Caution

Data Items cannot be used in page sections, because the latter are processed after the report data has been processed. At this moment the report data source is not available anymore.

 

Caution

Page sections are not related to the report itself, but are relative to the paper or screen. Thus page sections of nested/detail reports are ignored and only the page sections of the main report are visible.

In order to have sections that repeat on every page similar to page sections, consider using an unbound group (no grouping criteria specified) and set the PrintOnEveryPage property of its sections to True. Be aware that you cannot use PageCount and PageNumber global objects in group sections.

 

Passing Parameters to a SubReport

To pass parameters to a SubReport click the ellipses of the Parameters property. Each parameter consists of a Parameter Name and Parameter Value.

Click the New button to add a parameter. Assuming you have assigned the ReportSource property the Parameter Name drop down list will contain the names of parameters defined in the report. Select a Parameter Name from drop down list to choose the target for this parameter. Parameter Value takes a literal value, "<blank>" or select "<expression>" to invoke the Edit Expression dialog.

SubReport Height Issues

To remove blank vertical space in the detail section of a SubReport, set the Height of the SubReport.ReportSource DetailSection to the height of the tallest item. Sections can grow to accommodate their children but cannot shrink to hide empty space. If you want the detail section to shrink only at runtime you can set the Height property of the DetailSection in the report constructor. Place the Height property assignment code just after the IntializeComponent() method call.

See Also