问题
I am unable to access SSRS reports by passing parameter as a querystring. It doesn't yield any result. I did try passing parameter with &rs:par1=value or with &rc: as well.
SSRS reports contains spaces as well. URL which provides all report's list is like: http://ipaddress:port/Reports/Pages/Folder.aspx?ItemPath=%2fMyfolder
After clicking on any report http://ipaddress:port/Reports/Pages/Report.aspx?ItemPath=%2fMyfolder%2fReused+Report+v2
I did look at .rdl file & tried suffixing parameter like &rs:par1=value or &rc:par1=value but didn't work.
What's wrong?
回答1:
You need to use reportServer URL ( http://ipaddress:port/Reportserver) instead of Report Manager URL ( http://ipaddress:port/Repors) and frame URL like
http://hostname:portnumber/ReportServer?/AdventureWorks 2008R2/Employee_Sales_Summary_2008R2&ReportMonth=3&ReportYear=2008
回答2:
.cshtml
<iframe id="frmReport" src="ReportURL" frameborder="0" scrolling="no">
controller(GET method)
ReportURL = String.Format("../../Report/WebForm.aspx?Param1Name={0}&Param2Name={1}",Param1Value, Param2Value);
WebForm.aspx.cs page
Include---> (using ReportParameter = Microsoft.Reporting.WebForms.ReportParameter;
)
ReportParameter[] param = new ReportParameter[2];
param[0] = new ReportParameter("Param1Name", Request["Param1Name"].ToString());
param[1] = new ReportParameter("Param2Name", Request["Param2Name"].ToString());
ReportViewer1.ServerReport.SetParameters(param);
来源:https://stackoverflow.com/questions/29001290/ssrs-reports-with-querystring