Home / Community & Support / Knowledge Base / Telerik Reporting / General, Installation / ReportViewer.Report property is now of type Telerik.Reporting.IReportDocument

ReportViewer.Report property is now of type Telerik.Reporting.IReportDocument

Article Info

Rating: 3

Article information

Article relates to

Telerik Reporting Q1 2009+

Created by

Steve, Telerik

Last modified

March 16, 2009

Last modified by

Steve, Telerik


PROBLEM
ReportViewer.Report property is no longer of type Telerik.Reporting.Report, but of Telerik.Reporting.IReportDocument.

DESCRIPTION
With the new version of Telerik Reporting - Q1 2009 (v.3.0.9.311) -  we introduced a new functionality, called Report Book, that allows you to combine two or more reports in a single document.  While developing the new feature, our primary goal was to make the reporting engine work  no matter if it should render one or more reports. This new requirement imposed the need to abstract the single Report and the aggregation of two or more reports into the new IReportDocument interface.

Starting with the 2009 Q1 version of Telerik Reporting both Windows Forms and ASP.NET Report Viewer controls operate with IReportDocument objects instead of single Report objects. Compared to the Report object the new interface exposes a limited functionality that we consider common for both Report and Report Book. This means that it is not possible to use the ReportViewer.Report property as before and this applies to both viewers.

SOLUTION
In case you are sure that the viewer is currently showing a single report and you need to access its properties, you can always cast the object returned by the ReportViewer.Report property to Telerik.Reporting.Report type:

C#
Telerik.Reporting.Report report = (Telerik.Reporting.Report)this.reportViewer1.Report;  
report.DataSource = ds; 

VB.NET
Dim report As Telerik.Reporting.Report = DirectCast(Me.reportViewer1.Report, Telerik.Reporting.Report) 
report.DataSource = ds 

Another possible solution is to instantiate your report before passing it to the viewer so there is no need to access it through the viewer:

C#
MyReport myReport = new MyReport();  
myReport.DataSource = ds;  
  
this.reportViewer1.Report = myReport;  

VB.NET
Dim myReport As New MyReport() 
myReport.DataSource = ds 
 
Me.reportViewer1.Report = myReport 

Comments

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.