Closed aroraarjita closed 6 years ago
@aroraarjita, sorry for the late reply, I've been on vacation for the past 5 days.
The parameters come in a different way other than as arguments in the controller action because I'm using a single controller action (ViewReportPage) to do the work for all of the reports that anyone uses this for. However, in the GetReportViewerModel() it makes a call to "model.BuildParameters(Request);" which looks at the parameters that you have defined in your controller action to say what parameters should be there and they're passed in automatically because those fields are part of the form that gets posted.
I would setup a breakpoint on that line where I call model.BuildParameters(Request); inside the ReportController.cs to see your parameters come out and get setup on the model. The ReportData returning null indicates to me that the report isn't coming back appropriately from your server.
I hope this helps!
Alan
@alanjuden Thank you for taking out time and replying to my query. The explanation you provided was really helpful.
I was able to figure out the issue and here is the explanation of went wrong-
1) The parameters I was passing was of the format 'aa','bb','cc','dd'. 2) So, when I passed the parameters as "'aa','bb','cc','dd'", the single quotes and double quotes in the value of parameters created a syntax error and the values in the runtime jquery file was not giving proper values. 3) Hence, the '$('.ParametersContainer :input').serializeArray()' was not able to return proper parameter values from the runtime script. 4) I was able to get the value of parameter which was text i.e First parameter and rest all were coming to be null.
I tested it for other report where I just had to pass only text value and it's working well.
Though, I will continue to work on to find out a way where I can pass the parameters in a format "'aa','bb','cc','dd'".
Please share if you have any thoughts on passing the parameters of such a format. Once again, thanks for your time and effort on this question.
Hi,
Just thought to share the reply to above question of passing parameters in the form "'aa','bb','cc','dd'". This can be done by using ' for apostrophe i.e (') and using , for the comma (,) and it will work well.
Thanks!
Hi @alanjuden ,
Thanks for the wonderful code on MVCReport Viewer. But, I am facing an issue with Report data while I click on ViewReport.
Issue-
1) I am using .Net core project of your solution 2) While I click on ViewReport, the control goes to ViewReportPage method of report controller(as expected). 3) From there it goes to a method to GetReportViewerModel (as expected) to set the values of the model. 4) Then it goes to '_getRequestValue(request, "ReportViewerEnablePaging")' method. Where for my code it says 'request.Form' does not exists. It goes to catch block and returns. 5) Before it returns from GetReportViewerModel method, the model contains only the first parameter value and for the rest of the parameters I am just able to see the parameter names and not the values.
Since the parameters are not getting passed properly, I guess the Report Data is coming out to be null.
One more question I have is
Doubt- when we make a call to ViewReportPage method, from view ($.get("/Report/ViewReportPage/?reportPath=@Model.ReportPath.UrlEncode()&page=" + page + "&" + urlParams) we are passing urlparams only but in the method we are receiving only two parameters " public JsonResult ViewReportPage(string reportPath, int? page = 0)" report path and page.
Could you please let me know why we are passing the parameters if we are not receiving the same.
Any help on this issue would be highly appreciable as I would be able to use your code to generate the reports.
Thank you.