在ReportViewer控件中显示SSRS报告

发布于 2024-09-28 06:15:13 字数 1983 浏览 3 评论 0原文

View 有一个运行 SSRS 的中央报表服务器,我们所有的报表都已构建并存在于服务器上。

我现在如何使用 ASP.NET 中的 ReportViewer Control 显示其中一份报告?

我的控制:

<rsweb:ReportViewer ID="ctReportViewer" runat="server"  />

我的代码隐藏:

var reportServer = ctReportViewer.ServerReport;
        reportServer.ReportServerUrl = new Uri(@"http://<MYSERVERNAMEHERE>/reportsdev");
        reportServer.ReportPath = @"/OneFm/ArrearCollectionPerRegion";
        reportServer.ReportServerCredentials = new ReportViewerCredentials("<USERNAME>", "<PASSWORD>", "<DOMAIN>");
        ctReportViewer.DataBind();

public partial class ReportViewerCredentials : IReportServerCredentials
    {
        private string _userName;
        private string _password;
        private string _domain;

        public ReportViewerCredentials(string userName, string password, string domain)
        {
            _userName = userName;
            _password = password;
            _domain = domain;

        }


        public WindowsIdentity ImpersonationUser
        {
            get
            {
                return null;
            }
        }

        public ICredentials NetworkCredentials
        {
            get
            {

                return new NetworkCredential(_userName, _password, _domain);

            }
        }

        public bool GetFormsCredentials(out Cookie authCookie,
                out string userName, out string password,
                out string authority)
        {
            authCookie = null;
            userName = _userName;
            password = _password;
            authority = _domain;

            // Not using form credentials  
            return false;
        }
    }

链接到报告:

http://<MYSERVERNAMEHERE>/ReportsDev/Pages/Report.aspx?ItemPath=/OneFm/ArrearCollectionPerRegion

我已经搜索了很多。

我正在运行 SSRS2005,并且我正在使用 VS2008(如果这有什么意义的话)。

一个例子将不胜感激。

View have a central report server running SSRS, all our reporta are already built and present on the server.

How can i now dispaly one of those reports using ReportViewer Contontrol in ASP.NET?

My Control:

<rsweb:ReportViewer ID="ctReportViewer" runat="server"  />

My CodeBehind:

var reportServer = ctReportViewer.ServerReport;
        reportServer.ReportServerUrl = new Uri(@"http://<MYSERVERNAMEHERE>/reportsdev");
        reportServer.ReportPath = @"/OneFm/ArrearCollectionPerRegion";
        reportServer.ReportServerCredentials = new ReportViewerCredentials("<USERNAME>", "<PASSWORD>", "<DOMAIN>");
        ctReportViewer.DataBind();

public partial class ReportViewerCredentials : IReportServerCredentials
    {
        private string _userName;
        private string _password;
        private string _domain;

        public ReportViewerCredentials(string userName, string password, string domain)
        {
            _userName = userName;
            _password = password;
            _domain = domain;

        }


        public WindowsIdentity ImpersonationUser
        {
            get
            {
                return null;
            }
        }

        public ICredentials NetworkCredentials
        {
            get
            {

                return new NetworkCredential(_userName, _password, _domain);

            }
        }

        public bool GetFormsCredentials(out Cookie authCookie,
                out string userName, out string password,
                out string authority)
        {
            authCookie = null;
            userName = _userName;
            password = _password;
            authority = _domain;

            // Not using form credentials  
            return false;
        }
    }

Link to report:

http://<MYSERVERNAMEHERE>/ReportsDev/Pages/Report.aspx?ItemPath=/OneFm/ArrearCollectionPerRegion

I've searched high and low.

I am running SSRS2005, and i am using VS2008 if that counts for anything.

An example would really be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵性 2024-10-05 06:15:13

设法弄清楚了:

        var reportName = "SalesTargets"
        ctReportViewer.ServerReport.ReportServerUrl = new Uri("http://<MYREPORTSERVER>/reportserverdev");
        ctReportViewer.ServerReport.ReportPath = @"/OneFm/" + reportName;
        ctReportViewer.ProcessingMode = ProcessingMode.Remote;
        ctReportViewer.ServerReport.Refresh();
        ctReportViewer.AsyncRendering = false;
        ctReportViewer.SizeToReportContent = true;

Managed to figure it out thanx:

        var reportName = "SalesTargets"
        ctReportViewer.ServerReport.ReportServerUrl = new Uri("http://<MYREPORTSERVER>/reportserverdev");
        ctReportViewer.ServerReport.ReportPath = @"/OneFm/" + reportName;
        ctReportViewer.ProcessingMode = ProcessingMode.Remote;
        ctReportViewer.ServerReport.Refresh();
        ctReportViewer.AsyncRendering = false;
        ctReportViewer.SizeToReportContent = true;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文