How to run report in ReportViewer without having to click View Report button?
- by user259286
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 = ProcessingMode.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!