Hello,
I try to update my Telerik Reports from Q2 2015 to R2 2017. With my report books I have massive problems to get the data into the report.
My code so far (working perfect in Q2 2015) for ReportBook creation:
ReportBook trbReport =
new
ReportBook ();
// Instances of Telerik Report for Report Book
TPage1Report reportPage1 =
new
TPage1Report;
TPage2Report reportPage2 =
new
TPage2Report;
// Add Reports to ReportBook
trbReport.Reports.Add (reportPage1);
trbReport.Reports.Add (reportPage2);
// Add Datasources to report pages
ReportDatasourceClass1 ds1 =
new
ReportDatasourceClass1 ();
ReportDatasourceClass2 ds2 =
new
ReportDatasourceClass2 ();
trbReport.Reports[0].DataSource = ds1;
trbReport.Reports[0].DataSource = ds2;
And in code behind of the Report itself (I have a Table in the Detail Section, which datasource should be a list in the Reports datasource):
private
void
detail_ItemDataBinding (
object
sender, EventArgs e)
{
ReportDatasourceClass1 data = DataSource
as
ReportDatasourceClass1;
// Set Datasource of Telerik.Reporting.Table in Report to List Property
// in Datasource of report
tTable.DataSource = data.List1;
}
This is not working anymore in R2 2017: The Table in the Report is empty and in the second page I have some graphs, which datasources are also set in DetailItemDataBinding, which are also empty.
The Reports Property of ReportBook is marked as obsolete, so I tried ReportSources.
Problem 1: ReportSources has no property "DataSource". My way to set the DataSource of my report pages is impossible.
Problem 2: The Parameters Section of the ReportSources entries are empty (not filled with the parameter lists from the Reports.
So I tried the following to fix that behaviour:
TPage1Report page1 =
new
TPage1Report ();
page1.ReportParameters[
"param1"
].Value = param1Value;
page1.DataSource = page1DataSourceInstance;
trbReport.ReportSources.Add (page1);
TPage2Report page2 =
new
TPage2Report ();
page2.DataSource = page2DataSourceInstance;
trbReport.ReportSources.Add (page2);
Now in the DetailItemDataBinding my datasource is present, but in the rendered Report the List and Graphs still empty.
Has someone solved the ReportBook Datasource in 2017 R2 yet (I used this above method successfully since 2009)?
Greetings
Thomas