locked
Get Parameters Currently Selected on screen... RRS feed

  • Question

  • I have a webform with a ReportViewer 2010 control.  For each report, I have a variable that is part of the web site's session.  When I add that to the Report via setParamters, the parameter is accepted, but it resets the other parameters to the report defaults.  In other words, you click a date, type into a text field, select a radio button.  On postback the session variable is added and the client side selected variables are reset to defaults.  If I do not call setParameters, everything works fine.  Can you collect the client side parameter values, then add them to an array and put in setParameters?  I tried this and still get default values.

    thanks!


    -MBowles
    Friday, June 18, 2010 11:27 AM

Answers

  • I think it depends on how the postback is triggered. If you click the View Report button in the parameter prompt area, then the parameter values will be submietted.

    Not sure if this applies to your scenario, but the View Report button raises the ReportViewer.SubmittingParameterValues event. If you want, you can add your session variable as a report parameter like so:

    ReportViewer1.SubmittingParameterValues += new ReportParametersEventHandler(ReportViewer1_SubmittingParameterValues);

    ....

    void ReportViewer1_SubmittingParameterValues(object sender, ReportParametersEventArgs e)
    {
          e.Parameters.Add(new ReportParameter("ShowDescription", "True"));
    }

     


    Cephas Lin This posting is provided "AS IS" with no warranties.
    • Marked as answer by Mbowles Thursday, June 24, 2010 1:50 PM
    Friday, June 18, 2010 5:07 PM

All replies

  • I think it depends on how the postback is triggered. If you click the View Report button in the parameter prompt area, then the parameter values will be submietted.

    Not sure if this applies to your scenario, but the View Report button raises the ReportViewer.SubmittingParameterValues event. If you want, you can add your session variable as a report parameter like so:

    ReportViewer1.SubmittingParameterValues += new ReportParametersEventHandler(ReportViewer1_SubmittingParameterValues);

    ....

    void ReportViewer1_SubmittingParameterValues(object sender, ReportParametersEventArgs e)
    {
          e.Parameters.Add(new ReportParameter("ShowDescription", "True"));
    }

     


    Cephas Lin This posting is provided "AS IS" with no warranties.
    • Marked as answer by Mbowles Thursday, June 24, 2010 1:50 PM
    Friday, June 18, 2010 5:07 PM
  • chaching...that's what I was looking for, works great!
    -MBowles
    Thursday, June 24, 2010 1:50 PM