locked
SSRS report parameter in ASP.NET RRS feed

  • Question

  • User879871256 posted

    Is there any way to get the list of parameters including any list of values or anything else in an ASP.NET web page (C#).  I am trying to construct a page where the user can reference multiple reports from SSRS 2008 R2;  select parameters for each report and then run them with one click.  Also they should be able to save their selections so they do not have to select the parameters every single time.  I should also point out that the reports have a varying number of parameters of an assorted type (text box, datetime, LoVs, etc.)

    Any help in pointing me to the right direction will be greatly appreciated.

    Tuesday, June 21, 2011 3:02 PM

Answers

  • User2105670541 posted

    you just need to create a lit like below: where you can pass the parameters to the report, whatever you want to pass as a parameter to a particular report you can pass, for preserving the values, asp.net viewstate mode is always there, so you just create server controls for passing your parameters, and based on the click of your retrieve button, set the report path in reportviewer control. and then pass the parameter report requires as below:

    ReportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ServerPath"].ToString());

    ReportViewer1.ServerReport.ReportPath = "/MyReportName";

    ReportParameter[] parameters;

    parameters =new ReportParameter[2];

    parameters[0] =new ReportParameter("EmployeeCode", _txtEmployeeCode.Text);

    parameters[1] =new ReportParameter("EmployeeCity", ddlCity.SelectedValue);

    ReportViewer1.ServerReport.SetParameters(parameters);

     

    hope it will help

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 22, 2011 12:26 AM

All replies

  • User2105670541 posted

    you just need to create a lit like below: where you can pass the parameters to the report, whatever you want to pass as a parameter to a particular report you can pass, for preserving the values, asp.net viewstate mode is always there, so you just create server controls for passing your parameters, and based on the click of your retrieve button, set the report path in reportviewer control. and then pass the parameter report requires as below:

    ReportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ServerPath"].ToString());

    ReportViewer1.ServerReport.ReportPath = "/MyReportName";

    ReportParameter[] parameters;

    parameters =new ReportParameter[2];

    parameters[0] =new ReportParameter("EmployeeCode", _txtEmployeeCode.Text);

    parameters[1] =new ReportParameter("EmployeeCity", ddlCity.SelectedValue);

    ReportViewer1.ServerReport.SetParameters(parameters);

     

    hope it will help

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 22, 2011 12:26 AM
  • User879871256 posted

    Thanks Ashutosh.  That is a start at least.  Will try it tonight and post back with any progress I might make.

    Wednesday, June 22, 2011 2:55 AM
  • User1471008070 posted

    Hi Abbas,

    What's the process currently? I think it should work, I mark it as answer, if you have any feedback, please feel free to let us know.

    Wednesday, June 29, 2011 6:29 AM