i made a business object with properties to be shown on the report.
it had all well formated strings, and collections to fill subreports.
this collections are properties.
each collection is made with the same technique, string well formated properties.
the main business object is a collection too, and has just 1 object(with collection for the subreport).
subreports datasource is provided on main report detail_ItemDataBinding like:
private void detail_ItemDataBinding(object sender, System.EventArgs e)
{
Processing.DetailSection section = sender as Processing.DetailSection;
DataRowView dRow = section.DataItem as DataRowView;
if (dRow != null)
{
StaffelSubReport.ReportSource.DataSource = (StaffelRptCollection)dRow["StaffelData"];
MateriaalSubReport.ReportSource.DataSource = (MateriaalRptCollection)dRow["Artikel_Materialen"];
BewerkingSubReport.ReportSource.DataSource = (BewerkingRptCollection)dRow["ArtikelBewerkings"];
}
}
all data is correctly provided( was the first thing i have checked)
the problem is in 2 places
1st ReportViewer
report viewer is showing error when rendering subreports, each field says something like
"#ERROR# The expression contains object 'OpstelUren' that is not defined in the current context." but there is a property called like this.
Then , i tryed with ReportViewer export to pdf(this is my main specification) and the report was 100% correctly, subreport was filled perfectly. So, i look in forums and found how to export directly to pdf from code behind.
i did this with Telerik.Reporting.Processing.ReportProcessor.Render method, and HAPPENED the same with the reporViewer, showing the pdf with errors on the subreport fields.
i think there is a bug when rendering because ReporViewer shows bad on first bur exporting from this control is good, and exporting directly from the codeBehind works bad like the web rendering of the reporViewer control.
it had all well formated strings, and collections to fill subreports.
this collections are properties.
each collection is made with the same technique, string well formated properties.
the main business object is a collection too, and has just 1 object(with collection for the subreport).
subreports datasource is provided on main report detail_ItemDataBinding like:
private void detail_ItemDataBinding(object sender, System.EventArgs e)
{
Processing.DetailSection section = sender as Processing.DetailSection;
DataRowView dRow = section.DataItem as DataRowView;
if (dRow != null)
{
StaffelSubReport.ReportSource.DataSource = (StaffelRptCollection)dRow["StaffelData"];
MateriaalSubReport.ReportSource.DataSource = (MateriaalRptCollection)dRow["Artikel_Materialen"];
BewerkingSubReport.ReportSource.DataSource = (BewerkingRptCollection)dRow["ArtikelBewerkings"];
}
}
all data is correctly provided( was the first thing i have checked)
the problem is in 2 places
1st ReportViewer
report viewer is showing error when rendering subreports, each field says something like
"#ERROR# The expression contains object 'OpstelUren' that is not defined in the current context." but there is a property called like this.
Then , i tryed with ReportViewer export to pdf(this is my main specification) and the report was 100% correctly, subreport was filled perfectly. So, i look in forums and found how to export directly to pdf from code behind.
i did this with Telerik.Reporting.Processing.ReportProcessor.Render method, and HAPPENED the same with the reporViewer, showing the pdf with errors on the subreport fields.
i think there is a bug when rendering because ReporViewer shows bad on first bur exporting from this control is good, and exporting directly from the codeBehind works bad like the web rendering of the reporViewer control.