New to Telerik Reporting? Download free 30-day trial

Change Sub Report based on Main Report's Data


Product Progress® Telerik® Reporting
Report Item SubReport


This article explains how to change the ReportSource of the SubReport based on Main Report's Data.


You can use a user function in a binding to the SubReport item's ReportSource property. The function should return a valid ReportSource object that wraps a report - the subreport.

For example, the following user function:

public static ReportSource SetReportSource(string field)
      var TRS = new TypeReportSource();
      TRS.Parameters.Add("Parameter1", field);
      if (field.ToLower() == "yes")
          TRS.TypeName = typeof(SubReport1).AssemblyQualifiedName;
          TRS.TypeName = typeof(SubReport2).AssemblyQualifiedName;
      return TRS;

You should set the following Binding to the SubReport item in the Main report:

Property path: ReportSource

Expression: = SetReportSource(Fields.MainReportFieldX)

See Also

Extending Reporting Engine with User Functions

In this article