I am running SSRS 2008 in SP2010. I want to set some report parameters through JavaScript. Is it possible if yes then how. Basically I read some values from the page itself and then set the report parameter.I am using default report viewer web part to view the reports.
-
@jameslove is the guy to answer this– Hugh WoodCommented May 24, 2013 at 9:21
-
Are you viewing the Reports via the Report Viewer Web Part? Or some other way?– James LoveCommented May 24, 2013 at 9:22
-
Please see the edit.I am using report viewer web part.– V.BCommented May 24, 2013 at 9:25
1 Answer
Doing this via the Report Viewer Web Part might be quite tricky - as the way this web part sets the Report Parameter values is all done server-side. The closest you'd get to client side interactiveness is with Filter Web Parts.
However, you might be able to have something slightly more client side by loading the Report via an IFRAME.
Basically, you need to set the address of the IFRAME dynamically in your javascript, by pointing to
http:///_layouts/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/DocLibrary/ReportName.rdl&rp:YourFirstParam=Value&rp:YourSecondParam=Value
Note the rp: parameters, those are the ones you want to build up in your JavaScript to build the URL for the IFRAME. Note the syntax too, you'll need rp:= for each one.
-
I think if I am running my report on a Web Part page can I still use rp: to pass my parameter? I doubt this?– V.BCommented May 24, 2013 at 9:44
-
Nope, you'll basically render the IFRAME dynamically using JavaScript instead of the Report Viewer Web Part. The JavaScript suggestion replaces that web part. Commented May 24, 2013 at 9:47
-
Well this is my limitation. I can not do that.I need to do it on a web part page which already shows another page within a IFrame which is my target page.– V.BCommented May 24, 2013 at 10:00