views:

143

answers:

1

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!

A: 

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.

Jon
The answer is: Always set credentials before Set parameters. Assigning Credentials starts a new sessions and so resets the page therefore resetting your params. So, in my code above, just take the credential lines and move them to the top of the method.
Good job figuring it out.
Jon