2014-02-05 81 views
0

我正在用VS2012在ASP.NET C#framework 4.0中執行一個項目。我需要創建一個ReportViewer。我創建了報告.rdlc,但是當我嘗試在視圖中顯示它時,它顯示爲空白(報告查看器控件的工具欄出現並顯示1/1頁)。我在IE9,IE10,Mozilla和Chrome上測試過,結果是一樣的。報表查看器沒有在ASP.NET WebForms中顯示

下面是這個視圖的代碼:

<%@ 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> 

這裏是後面的代碼:

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(); 

    } 

我檢查所有的變量具有價值,報告的路徑正確。啊,我用一個名爲Dataset1的DataSet填充報表,並且這個表有一個名爲Bolo的表,它有字段「compañia」,「fecha」等...

我添加到web.config中,所有與reportviewer控制,具體版本11.

在此先感謝。

回答

0

試試這個:

  1. 編輯 「C:\ Program Files文件\ Microsoft SQL Server的\ MSRS10_50.MSSQLSERVER \ Reporting Services的\ ReportManager \ JS \ ReportingServices.js」(SSRS的服務器上)
  2. 追加以下腳本:

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

關注請:div的名稱並不總是ctl31_ctl09:在我的情況下(它以前的服務包是ctl31_ctl10,而不是)。

如果此解決方案無效,請查看瀏覽器中的HTML以查看腳本是否正常工作,將overflow:auto屬性更改爲overflow:visible;也許,你必須在sctipt中更改div名稱。

+0

它沒有運行,在我的情況下是'ReportViewer1_ct109',但在這個div裏面,存在一個可能是這個問題:

\t \t \t \t \t
AlexAlvarez

+0

你可以分享一個公共URL來查看你的應用程序嗎? –

+0

目前它不在網絡中,我用VS2012創建它,目前我在應用程序內進行調試,但是這個應用程序是爲本地使用,而不是在www,我可以共享代碼,或者如果你需要一些信息,我可以分享所有這些沒有問題,謝謝。 – AlexAlvarez

相關問題