How to run report in ReportViewer without having to click View Report button?
I've set up my report with params and it's value. When I run the page, it wants me to click the View Report button, but I need it to just run instead of interacting.
Any ideas on this?
Here's my code:
rptViewer.Reset();
rptViewer.ProcessingMode = Processing开发者_如何学JAVAMode.Remote;
rptViewer.ServerReport.ReportServerUrl = new Uri("http://rptserver/reportserver");
rptViewer.ServerReport.ReportPath = "/Reports/My Report";
ReportParameterInfoCollection param = rptViewer.ServerReport.GetParameters();
ReportParameter[] rps = new ReportParameter[]
{new ReportParameter(param[0].Name, param[0].ValidValues[0].Value)};
rptViewer.ServerReport.SetParameters(rps);
IReportServerCredentials netCred = new CustomReportCredentials("me", "pwd", "domain");
rptViewer.ServerReport.ReportServerCredentials = netCred;
rptViewer.ServerReport.Refresh();
rptViewer.SizeToReportContent = true;
Thanks!
Sounds like you have the initial webpage setup as a link to the reportcontrol. Try setting the startpage to the webpage that the reportcontrol is displayed on.
精彩评论