Cannot implicitly convert type Telerik.Reporting.XXXReportSource to Telerik.ReportViewer.Html5.WebForms.ReportSource
Environment
Product | Progress® Telerik® Reporting |
Description
Cannot implicitly convert type 'Telerik.Reporting.XXXReportSource' to 'Telerik.ReportViewer.Html5.WebForms.ReportSource' error when setting the ReportSource of the HTML5 WebForms Report Viewer.
Solution
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.
Examples of setting the ReportSource of HTML5 WebForms Report Viewer:
C#
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;
}
}
VB
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
See Also
How to: Set ReportSource for Report Viewers
How to display a report via InstanceReportSource in the HTML5 Viewer