I'm doing a project in ASP.NET C# framework 4.0 with VS2012. I need to create a 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). I tested it in IE9, IE10, Mozilla and Chrome, and the result is the same.
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...
I add to web.config all the lines related with the reportviewer control, concretly the version 11.
Thanks in advance.