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

.NET MVC Reporting Jquery Error

3 Answers 202 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Evan
Top achievements
Rank 1
Evan asked on 03 Sep 2014, 03:45 PM
I'm getting having a few issues with the MVC reporting implementation. I followed every step in this link here: http://www.telerik.com/help/reporting/mvc-report-viewer-extension-embedding.html, but I can't even display the product catalog report from adventure works. Initially, i was getting a JSON.Parse error in this function: On line 4, line 743 in the telerikReportViewer-8.1.14.804.js file included in my project.

01.function formatXhrError(xhr, status, error) {
02.            var err;
03.            if (xhr) {
04.                var msg = JSON.parse(xhr.reponseText);
05.                if (msg) {
06.                    err = msg.message;
07.                    if (msg.exceptionMessage) {
08.                        if (err) {
09.                            err += "<br/>";
10.                        }
11.                        err += msg.exceptionMessage;
12.                    }
13.                }
14.            }
15.            if (error) {
16.                err = error + ":<br/>" + err;
17.            }
18.            return err || error;
19.        }

After I stepped through the javascript, I found that the STATUS being passed into the function was a "parser error" and the ERROR was "unable to get report parameters". Initially, I was using the adventure works database and product catalog report, but I just decided to design my own from my own database. I used the report wizard inside Visual Studio 2012 and the preview worked great. However, as soon as I added it to the report viewer on my page, I get stuck here again.... Not sure what to do, because none of my reports take parameters. The report viewer shows up on my page no problem, but nothing is displayed.

My Razor page I'm displaying the report viewer on.
01.<div class="row fluid spacer" style="margin-bottom:0px">
02.    <div class="md-col-12">
03.@{
04.       var dataSource = new UriReportSource() { Uri = "recipients.cs" };
05.        //dataSource.Parameters.Add(new Telerik.Reporting.Parameter() { Name = "CheckNumber", Value = "2315527" });
06. 
07.    }
08.@(Html.TelerikReporting().ReportViewer()
09.       .Id("reportViewer1")
10.       .ServiceUrl("/api/reports/")
11.       .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate-8.1.14.804.html")
12.       .ReportSource(dataSource)
13.       .ViewMode(ViewModes.Read)
14.       .ScaleMode(ScaleModes.SPECIFIC)
15.       .Scale(1.0)
16.       .PersistSession(false)
17.       )
18.</div>
19.    </div>

You can tell I tried just messing with adding paramters, but no luck.



3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 03 Sep 2014, 04:05 PM
Hi Evan,

The Html5 Report Viewer is client-side widget served by a running Reporting REST service, which is dedicated to work with the viewer. If the viewer is loaded successfully, most probably the service is not responding at the set serviceUrl.

The best troubleshooting approach in such cases is to use the browser's console or Fiddler and check the failed requests. Thus you can see if relative paths (for JS/CSS/HTML files and the viewer's serviceUrl) in the application are resolved correctly. You can use Url.Content("~") method to get the proper base for the relative paths.

Then test if the service responds at its address and if you are able to see the export formats (the test is described in the last step of the How To: Add Telerik Reporting REST Web API to Web Application article).
Check also if the running process has proper read/write access to the cache storage defined in the service's CreateCache method. And finally verify the hosting environment allows the execution of all requests - POSТ, PUT, DELETE, GET.


Details how the HTML5 Report Viewer and Reporting REST service work are available in this forum thread. In the thread are provided help article elaborating on the required settings for the viewer and the service. You can also check our local demos installed by default under C:\Program Files (x86)\Telerik\Reporting <VERSION>\Examples.


If you need further help, please open a support ticket and send us the log file created by Fiddler, including the project to check its settings.


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
Evan
Top achievements
Rank 1
answered on 03 Sep 2014, 09:43 PM
Are there any other suggestions you may have? I can't be the only one who has received this error before. Moreover, you guys have the error directly defined in your java script code, I'm just telling you where it's spitting it out to me at. The formatting test worked fine, I just get the error "unable to get report parameters" and the status is "parsererror" when trying to actually view a report. I have the demo project opened up and working fine. Been comparing files for the last hour.
0
Stef
Telerik team
answered on 05 Sep 2014, 01:14 PM
Hi Evan,

In the given code snippet, you use an UriReportSource, which Uri is set to a CS file, where the expected value is the path to an XML/TRDX file (report in XML format).

If you need to display a report created with the integrated in Visual Studio Report Designer, you need to use a TypeReportSource and specify the report by its assembly qualified name (<namespace>.<report_name>, <assembly_name>).

For more details, please check my post in the ASP.net MVC4 using pass Model to ObjectDataSource forum thread.

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.

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