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

ReportViewer to send parameters and report name to controller API Rest

2 Answers 751 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Óscar
Top achievements
Rank 1
Óscar asked on 04 Sep 2019, 12:08 PM

C# ASP.NET MVC

I have the following code in view:

<script type="text/javascript">         

                $("#reportViewer1").telerik_ReportViewer({                 

                       templateUrl: "/Resources/Templates/telerikReportViewerTemplate.html",                 

                       serviceUrl: "/api/reports",                 

                       reportSource: {report: "VentasFamilia.trdp",

                                               parameters: {                     

                                                       Delegaciones: $("#filterDelegacion").data("kendoMultiSelect").value(),                               Familias: $("#filterFamilia").data("kendoMultiSelect").value(),                     

                                                      Series: $("#filterSerie").data("kendoMultiSelect").value(),                    

                                                      FechaInicio: $("#desde").val(),                     

                                                      FechaFin: $("#hasta").val()                   

                                                     }                 

                   }             

});     

</script>

How should I do on the controller to receive the parameters and name of the report?

2 Answers, 1 is accepted

Sort by
0
Francisco
Top achievements
Rank 1
answered on 05 Sep 2019, 07:23 AM
I have the same question.
0
Silviya
Telerik team
answered on 09 Sep 2019, 09:58 AM

Hi Óscar and Francisco,

The parameter values passed from the Html5 Report Viewer will be assigned to the Report Parameters of the report by matching parameters' names.

The client reportSource parameters collection is not accessible in Report Resolver. If you would like to use or set parameter values in the custom report resolver, it will be necessary to pass them as part of the reportSource().report string, and use custom logic in the resolver to extract those values and assign them manually to the corresponding report parameters. This can be done by instantiating/deserializing the report in the Resolve() method, setting the report parameters' values, wrapping the modified report instance in an InstanceReportSource and returning the latter to the reporting engine

Best Regards,
Silviya
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Óscar
Top achievements
Rank 1
Answers by
Francisco
Top achievements
Rank 1
Silviya
Telerik team
Share this question
or