Hi,
I am new in using Telerik reporting and considering moving from Crystal Report. I need help on display subreport data in WPF VS 2015. The application able to display the master report data but it doesn't show subreport data after added code for subreport. Below is my sample code.
private void frmMainWindowB_Loaded(object sender, RoutedEventArgs e)
{
//Get data
var objectDataSourceSub = new Telerik.Reporting.ObjectDataSource();
objectDataSourceSub.DataSource = GetSubData1(); // GetData returns a DataTable
var objectDataSourceMain = new Telerik.Reporting.ObjectDataSource();
objectDataSourceMain.DataSource = GetMainData(); // GetData returns a DataTable
//
var mainreport = new MyReportLib.SampleBMainRpt();
var Bsubrpt1 = new MyReportLib.SampleBSubReport1();
Telerik.Reporting.SubReport subreport1 = mainreport.Items.Find("subReport1", true).FirstOrDefault() as Telerik.Reporting.SubReport;
var reportSource = new Telerik.Reporting.InstanceReportSource();
reportSource.ReportDocument = mainreport;
mainreport.DataSource = objectDataSourceMain;
var SUBreportSource = new Telerik.Reporting.InstanceReportSource();
Bsubrpt1.DataSource = objectDataSourceSub;
SUBreportSource.ReportDocument = Bsubrpt1;
subreport1.ReportSource = Bsubrpt1;
reportViewerB.ReportSource = reportSource;
reportViewerB.RefreshReport();
}