Cannot implicitly convert type 'Telerik.Reporting.XXXReportSource' error
Environment
Product | Progress® Telerik® Reporting |
Report Viewer | HTML5 WebForms Report Viewer |
Description
An error is thrown when trying to set the ReportSource of the HTML5 WebForms Report Viewer.
Error Message
Cannot implicitly convert type 'Telerik.Reporting.XXXReportSource' to 'Telerik.ReportViewer.Html5.WebForms.ReportSource'.
Cause\Possible Cause(s)
Trying to set a report source of type Telerik.Reporting.XXXReportSource to the HTML5 WebForms Report Viewer. HTML5 WebForms Report Viewer expects a special report source of type Telerik.ReportViewer.Html5.WebForms.ReportSource.
Solution
Set the report viewer's ReportSource to an instance of the Telerik.ReportViewer.Html5.WebForms.ReportSource object type.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Telerik.ReportViewer.Html5.WebForms.ReportSource reportSource = new Telerik.ReportViewer.Html5.WebForms.ReportSource();
reportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.UriReportSource;
reportSource.Identifier = "Report1.trdp";
reportViewer1.ReportSource = reportSource;
}
}
Protected Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack Then
Dim reportSource As New Telerik.ReportViewer.Html5.WebForms.ReportSource()
reportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.UriReportSource
reportSource.Identifier = "Report1.trdp"
reportViewer1.ReportSource = reportSource
End If
End Sub
Notes
The HTML5 WebForms Report Viewer works with a client-side report source which is of type Telerik.ReportViewer.Html5.WebForms.ReportSource.
ReportSource.IdentifierType property specifies which resolver will be used for resolving the report description string on the server.
ReportSource.Identifier property accepts a string that contains information about the report. This string can be a path to a TRDP or TRDX file that can be resolved by ReportFileResolver, an assembly-qualified name of the report class which can be resolved by ReportTypeResolver or custom information which can be resolved by custom report resolver.
See Also
How to: Set ReportSource for Report Viewers
How to display a report via InstanceReportSource in the HTML5 Viewer