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

How to access report name and report parameters via JavaScript/Jquery in the report viewer.

2 Answers 316 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 23 Aug 2016, 12:21 PM

All of my reports shown in the report viewer in my MVC site.

However there is a need to add my own event to the viewer. (i.e. I will add a new button to the view).

My question is how can I get the report name and report parameters via javascript?  I will need this information to pass back to my controller to do my own "custom" action.

2 Answers, 1 is accepted

Sort by
0
Jim
Top achievements
Rank 1
answered on 23 Aug 2016, 01:33 PM

As a work around I added a string and ParameterCollection to my ViewModel and loaded the information that way.

However is it possible to serialize/deserialize the ParameterCollection?

I'm getting the error:

Could not cast or convert from System.String to Telerik.Reporting.ParameterCollection. when I try to deserialize the string.

I've tried:

1. Serializing the ParameterCollection in the controller (i.e. Defined as a string in ViewModel), passing it as a string and deserializing it in another controller.

2. Passing the ParameterCollection to the ViewModel (i.e. Defined as ParameterCollection in ViewModel), serializing it in JS and deserializing it in the controller.

0
Stef
Telerik team
answered on 23 Aug 2016, 02:32 PM
Hi Jim,

Below is a quote from my response in your support ticket on the same question:
"If the displayed report has visible parameters, the viewer will display its parameters area. Once the user select values for all parameters, the Preview button must be clicked in order the values to be submitted to the server. The last submitted values can be retrieved from the viewer's reportSource (report string and parameters Json stringified collection) - reportSource(rs)."


I hope this helps.

Regards,
Stef
Telerik by Progress
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
Jim
Top achievements
Rank 1
Answers by
Jim
Top achievements
Rank 1
Stef
Telerik team
Share this question
or