[英]Report Viewer is not showed in ASP.NET WebForms
我正在使用VS2012在ASP.NET C#Framework 4.0中進行項目。 我需要創建一個ReportViewer。 我創建了報告.rdlc,但是當我嘗試在視圖中顯示它時,它顯示為空白(報告查看器控件的工具欄出現並顯示1/1頁)。 我在IE9,IE10,Mozilla和Chrome中對其進行了測試,結果是相同的。
這是視圖的代碼:
<%@ 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的數據集,這個表有一個名為Bolo的表,其中包含字段compañia,fecha等。
我將與reportviewer控件相關的所有行添加到web.config中,確切地說是版本11。
提前致謝。
嘗試這個:
追加以下腳本:
function pageLoad() { var element = document.getElementById("ctl31_ctl09"); if (element) { element.style.overflow = "visible"; } }
請注意 :div的名稱並不總是ctl31_ctl09
:就我而言,它是(在以前的Service Pack中是ctl31_ctl10
)。
如果此解決方案不起作用,請從瀏覽器查看HTML,以查看腳本是否正常工作,將overflow:auto
屬性更改為overflow:visible
; 您可能需要在sctipt中更改div名稱。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.