我正在用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.
在此先感謝。
它沒有運行,在我的情況下是'ReportViewer1_ct109',但在這個div裏面,存在一個可能是這個問題:
你可以分享一個公共URL來查看你的應用程序嗎? –
目前它不在網絡中,我用VS2012創建它,目前我在應用程序內進行調試,但是這個應用程序是爲本地使用,而不是在www,我可以共享代碼,或者如果你需要一些信息,我可以分享所有這些沒有問題,謝謝。 – AlexAlvarez