Telerik Version: 6.1.12.820
foreach (...)
{
var genericSubReport = new GenericSubReport(data, title);
Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = genericSubReport;
//use w/o subreports defined
Telerik.Reporting.SubReport subReport = new Telerik.Reporting.SubReport();
subReport.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(subReportDefaultLocation), Telerik.Reporting.Drawing.Unit.Inch(currentLocation));
subReport.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(subReportWidthSevenPointNine), Telerik.Reporting.Drawing.Unit.Inch(subReportSpacer));
measureReport.Items["detailSection"].Items.Add(subReport);
subReport.ReportSource = instanceReportSource;
subReportIndex++;
currentLocation += LOCATION;
}
The subreport itself, builds the table in the code behind. We do all this becase it was either design 100+ reports or use a dynamic model. Other thing to note is the subreports do not use the NeedDatasource but do use the ItemDataBinding.
</Summary>

using System.Linq;using Bentley.SelectServer.Database;using System;namespace Bentley.SelectServer.Reporting{/// /*------------------------------------------------------------------------------------------------------*//// <summary>/// Summary description for MonthlyPeakUsage./// </summary>/// <author>marcus.kellermann</author> <date>7/23/2013</date>/// /*------------------------------------------------------------------------------------------------------*///public partial class MonthlyPeakUsage : Telerik.Reporting.Report, iBaseReportpublic partial class MonthlyPeakUsage : BaseReport, iBaseReport{public MonthlyPeakUsage() { InitializeComponent(); this.DocumentName = GetReportName(); this.crosstab1.NeedDataSource +=crosstab1_NeedDataSource; }///*--------------------------------------------------------------------------------------**//// <summary>/// Report Name used for Display in the report and parameters name/// </summary>/// <returns></returns>/// <author>Marcus.Kellermann</author> <date>07/2011</date>/*==============+===============+===============+===============+===============+==========*/public string GetReportName() { return ReportingStrings.MonthlyPeakUsageReport; }///*--------------------------------------------------------------------------------------**//// <summary>/// Creates the Report Configuration Object used to configure the reporting GUI/// </summary>/// <returns>Report Configuration</returns>/// <author>Marcus.Kellermann</author> <date>07/2011</date>/*==============+===============+===============+===============+===============+==========*/public ReportConfiguration GetReportConfiguration() { return new ReportConfiguration { ShowGeneralParametersTab=true, ShowMachineParametersTab=false, ShowUserParametersTab=false, ShowVirtualSites = false, ReportName = ReportingStrings.MonthlyPeakUsageReport, ShowIncludeDetails = false, ShowCAGOption = false }; }/// /*------------------------------------------------------------------------------------------------------*//// <summary>/// Handles the NeedDataSource event of the crosstab1 control./// </summary>/// <param name="sender">The source of the event.</param>/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>/// <author>marcus.kellermann</author> <date>7/23/2013</date>/// /*------------------------------------------------------------------------------------------------------*/private void crosstab1_NeedDataSource(object sender, EventArgs e) { Telerik.Reporting.Processing.Table table = (Telerik.Reporting.Processing.Table)sender; Telerik.Reporting.Processing.Report rpt = table.Report; DateTime startDate = (DateTime)rpt.Parameters[ReportParameterNames.StartDate].Value; DateTime endDate = (DateTime)rpt.Parameters[ReportParameterNames.EndDate].Value; String userID = (String)rpt.Parameters[ReportParameterNames.UserID].Value; string reportID = (String)rpt.Parameters[ReportParameterNames.ReportID].Value; Boolean includeWeekends = (bool)rpt.Parameters[ReportParameterNames.IncludeWeekends].Value; //Jiao: Add UltimateID to ReportParameter long ultimateID = long.Parse ((string)rpt.Parameters[ReportParameterNames.UltimateID].Value); var reportDataSet = Reports.MonthlyPeakUsage(startDate, endDate, userID, new Guid(reportID), includeWeekends, ultimateID); ReportUtils.CheckReportSize(reportDataSet.MonthlyPeakUsage.Count()); table.DataSource = reportDataSet.MonthlyPeakUsage; }private void MonthlyPeakUsage_NeedDataSource(object sender, EventArgs e) { RPTLogger.Log.trace("In Report Need DataSource"); }