Cannot Show Reports in the ReportViewer
Environment
Product | Progress® Telerik® Reporting | Progress® Telerik® ReportViewer |
Version | Q2 2012 and later | |
Report Viewers | Legacy ASP.NET WebForms Viewer |
Description
The described scenario and suggested solution relate to the legacy ASP.NET WebForms ReportViewer. It is recommended that you migrate to the HTML5 ReportViewer.
I want to show my report in a ReportViewer control, but when I click the arrow in the ReportSource property from the property grid, it does not show available reports. What is wrong?
Cause
....
Solution
Follow the Telerik Reporting best practices and specify the report in a separate class library that is referenced in the application or website. Check if the class library containing the report is referenced in your application or website and that you have rebuilt the project.
The most reliable way to handle this scenario is to programmatically specify a report for the ReportViewer. For example, if you're using the ASP.NET ReportViewer, state the following in the Page_Load
event of the page:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
var typeReportSource = new Telerik.Reporting.TypeReportSource();
typeReportSource.TypeName = "Telerik.Reporting.Examples.CSharp.ListBoundReport, CSharp.ReportLibrary";
this.ReportViewer1.ReportSource = typeReportSource;
}
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim typeReportSource As New Telerik.Reporting.TypeReportSource()
typeReportSource.TypeName = "ListBoundReport, VB.ReportLibrary"
ReportViewer1.ReportSource = typeReportSource
ReportViewer1.RefreshReport()
End If
End Sub