I need to pass a value as a parameter from ASP.Net application to SSRS Report.How can i do this?Can anybody help me ?
Thanks in advance.
To set available values for the second parameter In the Report Data pane, in the Parameters folder, right-click the first parameter, and then click Parameter Properties. In Name, verify that the name of the parameter is correct. Click Available Values. Click Get values from a query.
Follow the following line and try it...
ReportViewer1.ServerReport.ReportServerUrl = new System.Uri("http://MyPC/reportserver");
ReportViewer1.ServerReport.ReportPath = "/ReportFolder/Reportname";
Microsoft.Reporting.WebForms.ReportParameter[] Param = new Microsoft.Reporting.WebForms.ReportParameter[3];
Param(2) = new Microsoft.Reporting.WebForms.ReportParameter("SDATE", "02/02/2002");
Param(1) = new Microsoft.Reporting.WebForms.ReportParameter("EDATE", "09/06/2000");
Param(0) = new Microsoft.Reporting.WebForms.ReportParameter("TASK", 0);
View.ReportViewer.ShowParameterPrompts = false;
View.ReportViewer.ServerReport.SetParameters(Param);
View.ReportViewer.ServerReport.Refresh();
You can pass the parameter values in the URL used to get the report.
Also you should disable the "Promt user (for parameters)" in /reports/Pages/Folder.aspx
for your report.
Example of setting a parameter named ParameterName
:
/Reports/Pages/Report.aspx?...&ParameterName=ParameterValue
Viewing Reports with a Browser
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With