如何在ReportViewer中运行报表而无需单击“查看报表”按钮?

时间:2010-03-24 22:58:53

标签: button view reportviewer report

我用params设置我的报告,它的价值。当我运行页面时,它希望我单击“查看报告”按钮,但我需要它才能运行而不是交互。

有关于此的任何想法吗?

这是我的代码:

 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;

谢谢!

1 个答案:

答案 0 :(得分:0)

听起来您已将初始网页设置为reportcontrol的链接。 尝试将startpage设置为显示reportcontrol的网页。