views:

449

answers:

1

I am using ReportViewer.WebForms in asp.net page. I have the parameter toolbar showing up where I can select a parameter, it does a postback to get the next parameter (dependent on the first), and so forth.

When I click the "View Report" button there is a postback and the report will display fine.

All this works great.

What I would like to do is set the "ShowReportBody" to false

ReportViewer.ShowReportBody = False

At this point I would like to grab all the parameters that have been selected by the user and run the render method to export to a file (of my choosing .. maybe excel, maybe pdf .. does not really matter, nor is the topic of this question).

So, my question is, how (or can I) trap the button event of the "View Report" button? I would like to be able to use the ReportViewer UI in order to capture all the parameters instead of building custom parameters.

I'd also like to rename this, but, again .. another topic :)

A: 

You can use IsPostBack flag and QueryString

Example:


Viewer.ShowReportBody = false

if(IsPostBack)
{
    if(Request.QueryString["Exec"] = "Auto")
        Viewer.ShowReportBody = true;
    ...
}
else
{
    Viewer.ShowReportBody = true;
}
rusomaxo