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 f开发者_JS百科irst), 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 :)
You can use the IsPostBack
flag and QueryString
Example:
Viewer.ShowReportBody = false
if(IsPostBack)
{
if(Request.QueryString["Exec"] = "Auto")
Viewer.ShowReportBody = true;
...
}
else
{
Viewer.ShowReportBody = true;
}
精彩评论