How to run report in ReportViewer without having to click View Report button?

Posted by user259286 on Stack Overflow See other posts from Stack Overflow or by user259286
Published on 2010-03-24T22:58:52Z Indexed on 2010/03/24 23:03 UTC
Read the original article Hit count: 368

Filed under:
|
|
|

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!

© Stack Overflow or respective owner

Related posts about reportviewer

Related posts about view