简体   繁体   English

报表查看器未显示在ASP.NET WebForms中

[英]Report Viewer is not showed in ASP.NET WebForms

I'm doing a project in ASP.NET C# framework 4.0 with VS2012. 我正在使用VS2012在ASP.NET C#Framework 4.0中进行项目。 I need to create a ReportViewer. 我需要创建一个ReportViewer。 I created the report .rdlc, but when I try to show it in a view, it appears blank(the toolbar of the report viewer control appears and shows 1/1 page). 我创建了报告.rdlc,但是当我尝试在视图中显示它时,它显示为空白(报告查看器控件的工具栏出现并显示1/1页)。 I tested it in IE9, IE10, Mozilla and Chrome, and the result is the same. 我在IE9,IE10,Mozilla和Chrome中对其进行了测试,结果是相同的。

Here is the code of the view: 这是视图的代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FitxaBolo.aspx.cs" Inherits="Activa_la_Cultura.Views.FitxaBolo" %>

<%@ 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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>

    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>
    <div>
        <rsweb:ReportViewer AsyncRendering="False"  id="ReportViewer1" runat="server" Height="1200px" Width="1200px"></rsweb:ReportViewer>
    </div>
    </form>
</body>
</html>

And here is the code behind: 这是后面的代码:

    if (!Page.IsPostBack)
    {

        var compañia = (string)HttpContext.Current.Session["compañia"];
        var actividad = (string)HttpContext.Current.Session["actividad"];
        var municipio = (string)HttpContext.Current.Session["municipio"];
        var fecha = (string)HttpContext.Current.Session["fecha"];
        var lugar = (string)HttpContext.Current.Session["lugar"];
        var horario = (string)HttpContext.Current.Session["horario"];
        var llegada = (string)HttpContext.Current.Session["llegada"];
        var contacto = (string)HttpContext.Current.Session["contacto"];
        var observaciones = (string)HttpContext.Current.Session["observaciones"];

        var table = new DataSet1().Bolo;

        table.AddBoloRow(compañia, actividad, municipio, fecha, lugar, horario, llegada, contacto, observaciones);

        DataTable tb = (DataTable) table;
        var rds = new ReportDataSource(table.TableName,tb);
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.ProcessingMode = ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/FBolo_Report.rdlc");
        ReportViewer1.LocalReport.DataSources.Add(rds);          
        ReportViewer1.LocalReport.Refresh();

    }

I check that all the variables have the value, and the path of the report is correct. 我检查所有变量均具有值,并且报告路径正确。 Ah, I'm filling the report thorugh a DataSet called Dataset1, and this one has a table named Bolo that have the fields compañia, fecha, etc... 嗯,我在报表中填充了一个名为Dataset1的数据集,这个表有一个名为Bolo的表,其中包含字段compañia,fecha等。

I add to web.config all the lines related with the reportviewer control, concretly the version 11. 我将与reportviewer控件相关的所有行添加到web.config中,确切地说是版本11。

Thanks in advance. 提前致谢。

Try this: 尝试这个:

  1. Edit " C:\\Program Files\\Microsoft SQL Server\\MSRS10_50.MSSQLSERVER\\Reporting Services\\ReportManager\\js\\ReportingServices.js " (on the SSRS Server) 编辑“ C:\\ Program Files \\ Microsoft SQL Server \\ MSRS10_50.MSSQLSERVER \\ Reporting Services \\ ReportManager \\ js \\ ReportingServices.js ”(在SSRS服务器上)
  2. Append the following script: 追加以下脚本:

     function pageLoad() { var element = document.getElementById("ctl31_ctl09"); if (element) { element.style.overflow = "visible"; } } 

Attention please : div's name is not always ctl31_ctl09 : in my case it is (with a previous service pack it was ctl31_ctl10 , instead). 请注意 :div的名称并不总是ctl31_ctl09 :就我而言,它是(在以前的Service Pack中是ctl31_ctl10 )。

If this solution doesn't work, look at the HTML from your browser to see if the script has worked properly changing the overflow:auto property to overflow:visible ; 如果此解决方案不起作用,请从浏览器查看HTML,以查看脚本是否正常工作,将overflow:auto属性更改为overflow:visible ; you have to change div name in the sctipt, maybe. 您可能需要在sctipt中更改div名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM