New to Telerik Reporting? Download free 30-day trial

How to Set ReportSource for SubReport

This article includes details how to specify a sub report for a SubReport item. You will need a Report Source object.

Set the Report Source through the Report Designer

  1. In Design view, right-click a SubReport item to which you want to set a report source and click Properties.

  2. In the item's Properties , click ReportSource.

  3. A "Load a Report from" dialog appears which allows you to select a ReportSource.

  4. Select the type of report source you would use to specify a report. For this example we would use Instance Report Source , click that option and select the report that would serve as detail report.
    If you have to specify parameters for the report, follow the next step.

  5. Click Edit Parameters button - Edit Parameters dialog appears. Click New. In the Parameter Name column select the name of a report parameter in the detail report. In the Parameter Value , type or select the value to pass to the parameter in the detail report.

Set the Report Source programatically

    var instanceReportSource = new Telerik.Reporting.InstanceReportSource();

    // Assigning the Report object to the InstanceReportSource
    instanceReportSource.ReportDocument = new Telerik.Reporting.Examples.CSharp.Invoice();

    // Adding the initial parameter values
    instanceReportSource.Parameters.Add(new Telerik.Reporting.Parameter("OrderNumber", "SO43659"));

{{source=CodeSnippets\VB\API\Telerik\Reporting\ReportSourceSnippets.vb region=CreateInstanceReportSourceSnippet}}

    Dim instanceReportSource As New Telerik.Reporting.InstanceReportSource()

    ' Assigning the Report object to the InstanceReportSource
    instanceReportSource.ReportDocument = New Invoice()

    ' Adding the initial parameter values
    instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("OrderNumber", "SO43659"))

The Standalone Report Designer includes only XmlReportSource and UriReportSource options due to the format of the produced reports. In Visual Studio Report Designer you can use all available Report Sources.

If the report will be displayed in an HTML5 Viewer or Silverlight ReportViewer, the main report is rendered in HTML (XAML respectively) and it is loaded at the client. The sub report is considered as a content of the main report and its Report Source is resolved internally, withouit additional calls to the Reporting REST service (Reporting WCF Service respectively).

See Also

In this article