This is a migrated thread and some comments may be shown as answers.

MVC - ReportSource Resolve not called

2 Answers 223 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 2
Dan asked on 09 Jul 2014, 02:26 PM
I have an MVC4 web application with Razor pages.  The report page uses a UriReportSource for the Telerik ReportViewer.
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

2 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 10 Jul 2014, 04:57 PM
Hi Dan,

Most probably the service is not reachable at the given address. Verify the service is configured correctly and runs - How To: Add Telerik Reporting REST Web API to Web Application. In case the service is hosted separately, consider enabling CORS.

Please, use Fiddler to check the requests and their responses statuses, including the Raw content of the responses displayed in Fiddler's Inspectors tab. Thus you can see each request's URL and if it is the correct one.

If you need further help, please share the log file created by Fiddler. Feel free to open a support ticket and send us there the requested information.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dan
Top achievements
Rank 2
answered on 10 Jul 2014, 05:13 PM
Thanks for the reply.   But, this morning I found the problem.  The CustomReportResolver was being interfered by some WebForms code that I had copied from another project.  Got rid of that and the problem went away.
So, disregard this post.  Thanks.

Dan
Tags
General Discussions
Asked by
Dan
Top achievements
Rank 2
Answers by
Stef
Telerik team
Dan
Top achievements
Rank 2
Share this question
or