asp.net mvc调用ReportViewer来显示报告文件夹(不报告)

时间:2014-01-22 14:19:29

标签: asp.net asp.net-mvc-4 reportviewer

从asp.net mvc ....

调用时,我有ReportServer asp.net webform工作

第一个问题: 但我遇到的问题是显示一个报告文件夹内容...我正在窗体上移植功能窗口ReportServer以及Windows中的以下工作原理 直接来自浏览器:

http://www.mydomain.com/Reports/Pages/Folder.aspx?ItemPath=%2fB.+TBS

但是当我尝试在asp.net mvc中嵌入的asp.net中使用它时,除非我得到错误 为ReportServerUrl提供以下内容:http://www.mydomain.com/ReportServer 我试过了

serverReport1.ReportPath =“/ Pages / Folder.aspx?ItemPath =%2fB. + TBS”;

以及其他变体,我无法弄清楚如何显示文件夹...

第二个问题:目前我没有被提示登录...我没有在web.config中设置模拟....我想让用户输入他们的userId和密码....我怎么能强迫这发生了。

这是我当前的page_load:

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {


        ReportViewer1.ShowParameterPrompts = true;
        ReportViewer1.ShowToolBar = true;
        ReportViewer1.ShowRefreshButton = true;
        ReportViewer1.ShowCredentialPrompts = true;



        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
        ServerReport serverReport1 = ReportViewer1.ServerReport;

         //This works to display a report...        
         //    serverReport1.ReportServerUrl = new Uri("http://www.mydomain.com/ReportServer");
         //    serverReport1.ReportPath = "/B. TBS/B.2. Departments";

         //This works too...same thing ...getting ready to put into web.config...
                string url = @"http://www.mydomain.com/ReportServer";
                string ReportName = "B. TBS/B.2. Departments";
                serverReport1.ReportServerUrl = new System.Uri(url);
                serverReport1.ReportPath = string.Format("/{0}", ReportName);

         //This works in Windows, but not here...outputs..Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'
         //      serverReport1.ReportServerUrl = new Uri("http://www.mydomain.com/Reports/Pages/Folder.aspx?ItemPath=%2fB.+TBS");

      //   serverReport1.ReportServerUrl = new Uri("http://www.mydomain.com/ReportServer");
      //   serverReport1.ReportPath = "/Pages/Folder.aspx?ItemPath=%2fB.+TBS";

    }
}

这是我当前的asp.net webform:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportViewer.aspx.cs" Inherits="TBS.Etracs.Web.Main.Reports.Reports" %>


<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" 
             Namespace="Microsoft.Reporting.WebForms" 
             TagPrefix="rsweb" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server" style="width:100%; height:100%;">
    <div>

    </div> 
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <rsweb:ReportViewer  ID                    ="ReportViewer1"
                             runat                 ="server"
                             Width                 ="100%" 
                             Height                ="100%"
                             SizeToReportContent   ="True" >
        </rsweb:ReportViewer>
    </form>
</body>
</html>

感谢。

1 个答案:

答案 0 :(得分:0)

我发现了混乱的来源......

.... / Reports / ....界面从ReportService中公开ReportManager服务......

传统的.... / ReportService / ....正在使用ReportService内的ReportViewer服务。

对于Windows(我从中移植功能),应用程序正在使用ReportManager和ReportService接口....但我不知道这些是两种不同的服务....我认为它们都是ReportViewer服务,我无法弄清楚为什么文件夹的视图不起作用....

Windows应用程序也在使用ReportExplorer(客户端)应用程序......它在网络端没有类似的功能....

我发现通过链接到当前的ReportManager接口我可以做我想做的事情......这并不要求我使用asp.net ReportViewer控件作为客户端控件。

我现在拥有的只是重定向到ReportServer ...最终我将替换为IFrame(或IFrame)网页,它将与asp.net mvc应用程序共享一个公共母版页,这样我就可以报表服务器网页与应用程序的其余部分具有相同的页眉和页脚。

相关问题