none
Winforms ReportViewer Prevent Execution RRS feed

  • Question

  • I have a Winforms application that uses a ReportViewer, but only for the parameters section (the application handles everything else). I hide everything else. The problem is, for reports with all default parameters, it will render the report anyway, which is unnecessary and indeed quite the performance/memory bottleneck in the program. Is there a way to make sure that the Report Viewer doesn't automatically render the report, and simply display the parameters?
    Tuesday, May 11, 2010 4:13 PM

Answers

All replies

  • "Is there a way to make sure that the Report Viewer doesn't automatically render the report, and simply display the parameters?"

    How do you want to disply the parameters if the report viewer doesn't render the report?

    You could easily test the parameters before you pass them to the report and not render the report if the parameters match the default values. Is that what you are thinking?

    Bernie

    Tuesday, May 11, 2010 5:20 PM
  • I'm not passing any parameters to the report. I just want to load the parameters+defaults from the report server. The problem is, the report viewer at this point will automatically render the report if the default values are enough to render the report. This is what I don't want to happen.
    Tuesday, May 11, 2010 5:25 PM
  • Tristan,
    In your Windows Form's Form_Load event, you can first call reportviewer.Reset() to suppress your Reportviewer control to bind your server report. Or you do not set report properties for your reportviewer control at first. Instead, you can programmatically set reportviewer's report properties and report parameters when you click a button to view the report. You can refer to:
    ServerReport.SetParameters
    http://msdn.microsoft.com/en-us/library/ms252663.aspx

    If you just need to read parameters information of your report, after set the report, you can call the method reportviewer.ServerReport.GetParameters() to get the parameters information.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Wednesday, May 12, 2010 8:10 AM
    Moderator
  • I might have been a little bit unclear. I do want the parameters and their defaults to show up on the Report Viewer. For this reason, the things you mentioned don't seem to work, because they bring the report viewer all the way back to its initial state. What I don't want is for the report itself to be rendered. 

    If I simply set the report path programmatically, the parameters won't show up at all. They only show up if I call reportviewer.RefreshReport(). My problem is that RefreshReport() also renders the report.  

    Wednesday, May 12, 2010 4:00 PM
  • Hi Tristan,

    Unfortunately I do not think that this is possible in the current reportviewer control.  To improve the rendering performance, you may reduce your page size and use page break to improve performance. Here is an article for your reference:
    http://msdn.microsoft.com/en-us/library/cc966445.aspx

    If you are concerned with this issue, please submit a feedback at https://connect.microsoft.com/sql.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Tuesday, May 18, 2010 9:02 AM
    Moderator