How do I pass parameter TO SSRS report FROM ASP.NET page which has the reportviewer for the report

Santosh Chandavaram picture Santosh Chandavaram · Jul 1, 2009 · Viewed 18.2k times · Source

I have an ASP.NET page which has report viewer control to access reports from report manager.

  • I need to pass report parameter from this ASP.NET page to the report server.
  • I want to pass region number based on user logged in, which is displayed on a label in ASP.NET page.

Thanks.

Answer

Mcbeev picture Mcbeev · Jul 1, 2009

I'm assuming your using remote processing of the report.

Then do the following:

ReportParameter p = new ReportParameter("ParamName", "ParamVal");
reportViewer1.ServerReport.SetParameters(new ReportParameter[] { p });

From: http://msdn.microsoft.com/en-us/library/ms252178(VS.80).aspx

Good example: http://www.codeproject.com/KB/reporting-services/ReportViewer2005.aspx