I have an MVC4 web application with Razor pages. The report page uses a UriReportSource for the Telerik ReportViewer.
The cshtml code is:
The controller code is:
The problem is that the Resolve method is not being called, resulting in the reportviewer showing an error of:
Unable toget report parameters:
Report '500507|500029' cannot be resolved.
Why is Resolve not being called?
Dan
The cshtml code is:
@model StdPOTOrderPrint
@{
var uriRS = new UriReportSource() { Uri = @Model.ReportParms };
}
@(Html.TelerikReporting().ReportViewer()
.Id("reportViewer1")
.ServiceUrl(Url.Content("~/api/reports/"))
.TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate.html"))
.ReportSource(uriRS)
.ViewMode(ViewModes.INTERACTIVE)
.ScaleMode(ScaleModes.SPECIFIC)
.Scale(1.0)
.PersistSession(false)
)
The controller code is:
namespace CPR.WebPortal.Controllers
{
public class ReportsController : ReportsControllerBase
{
protected override IReportResolver CreateReportResolver()
{
return new CustomReportResolver();
}
protected override ICache CreateCache()
{
return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
}
}
public class CustomReportResolver : IReportResolver
{
public Telerik.Reporting.ReportSource Resolve(string reportparms)
{
string[] stringSeparators = new string[] {"|"};
string[] sarray = reportparms.Split(stringSeparators, StringSplitOptions.None);
long patientid = Convert.ToInt64(sarray[0]);
long orderid = Convert.ToInt64(sarray[1]);
....
PatientPhysicianOrderStandardPropertyBag orderBag = new PatientPhysicianOrderStandardPropertyBag();
PatientHelper.Populate(order, orderBag);
PatientPhysicianOrderStandardDataObject _dataSource = new PatientPhysicianOrderStandardDataObject(workContext, orderBag);
Telerik.Reporting.Report report = new DHS.Client.Controllers.Reporting.ReportDefinitions.PatientPhysicianOrderStandardReport();
report.DataSource = orderBag;
Telerik.Reporting.InstanceReportSource irs = new Telerik.Reporting.InstanceReportSource();
irs.ReportDocument = report;
return irs;
}
}
}
The problem is that the Resolve method is not being called, resulting in the reportviewer showing an error of:
Unable toget report parameters:
Report '500507|500029' cannot be resolved.
Why is Resolve not being called?
Dan