1

I have some code that calls a report, but even if I pass parameters into the report the user still needs to click the "View Report" button before the report itself will render. Is there any way to change this?

Function Report(vm As ReportParameterViewModel) As ActionResult
    ''lazy loading of report details, path
    Dim reportDetails = Reports.Value
    reportDetails.Load(vm.ReportId)

    ''private function that returns ReportViewer and sets a few details of it
    Dim viewer = SetUpReportViewer()
    viewer.ServerReport.ReportServerUrl = reportDetails.ReportServerUrl
    viewer.ServerReport.ReportPath = reportDetails.ReportPath
    viewer.ServerReport.SetParameters(GetParams(vm))
    viewer.ServerReport.Refresh()
    ViewBag.ReportViewer = viewer

    Return View()
End Function

Is there something I can add to have the report run immediately, without user interaction?

USER_8675309
  • 853
  • 2
  • 14
  • 33
  • are you sure that all parameters are set to report parameters? above method is correct you can achieve by doing same. – Pedram Dec 17 '15 at 09:46
  • @curiousguy the parameters are populating correctly through the `GetParams()` method. The inputs on the report are filled out with the correct params passed in, but there is a "View Report" button that still needs to be clicked in order to generate the report. Is this the expected functionality? Am I missing something? – USER_8675309 Dec 17 '15 at 13:14
  • I've never tried from controller. I'm using simple function to call report. still have you tried to set `ReportViewer.ProcessingMode = ProcessingMode.Remote;` also I've provided my code here in this [post](http://stackoverflow.com/questions/19247645/the-request-failed-with-http-status-401-unauthorized-in-ssrs/33520764#33520764) - please have a look. – Pedram Dec 18 '15 at 05:00
  • @curiousguy yeah, I mean this is basically what I am doing. I am using app pool for authentication as opposed to creating ServerCredentials. Inside the `SetUpReportViewer()` method it sets the width/height as well as the processing mode to remote. Currently my hacky work-around is to find the "View Report" button and call `click` on it via js – USER_8675309 Dec 18 '15 at 14:51
  • also you need to check that report's all parameters should be hidden from report manager. it will surely work – Pedram Jan 05 '16 at 10:52
  • Yes thank you. I have solved everything except having the report execute on load, but we have determined that the database owner will have to make some changes to move forward – USER_8675309 Jan 05 '16 at 14:20

0 Answers0