C# RDLC报告未显示数据
我已经阅读了所有我能找到的问题答案,但没有一个解决了我的问题 我有一个代表我的一行数据的类:C# RDLC报告未显示数据,c#,asp.net,report,rdlc,C#,Asp.net,Report,Rdlc,我已经阅读了所有我能找到的问题答案,但没有一个解决了我的问题 我有一个代表我的一行数据的类: public class SimpleGeofenceReportDTO { public string AssetId { get; set; } public string CompanyId { get; set; } public string SiteId { get; set; } public string CategoryId { get; set;
public class SimpleGeofenceReportDTO
{
public string AssetId { get; set; }
public string CompanyId { get; set; }
public string SiteId { get; set; }
public string CategoryId { get; set; }
public string StartDateTime { get; set; }
public string EndDateTime { get; set; }
public string GeofenceId { get; set; }
public string GeofenceEvent { get; set; }
public string EventDateTime { get; set; }
}
从Db读取数据并转换为DTO列表:
var reportList = geofenceReport.ToList();
var report = new List<SimpleGeofenceReportDTO>();
foreach (var geofenceRecord in reportList)
{
report.Add(new SimpleGeofenceReportDTO()
{
AssetId = geofenceRecord.iAssetId.ToString(),
CategoryId = geofenceRecord.iCategoryId.ToString(),
EndDateTime = geofenceRecord.dtUTCDateTime.ToString("dd/MM/yyyy"),
GeofenceId = geofenceRecord.iGeofenceId.ToString(),
GeofenceEvent = geofenceRecord.eEventCode == 6 ? "Geofence Enter" : "Geofence Exit"
});
}
ASP.NET网页代码:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div id="ReportContentDiv" runat="server">
<rsweb:ReportViewer ID="GeofenceSummaryReportViewer" runat="server"
Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana"
WaitMessageFont-Size="14pt" Width="98%" Height="98%">
<LocalReport ReportPath="TBReports\GeofenceSummaryReport.rdlc">
</LocalReport>
</rsweb:ReportViewer>
</div>
<div id="ErrorDiv" runat="server">
<span style="font-family: Arial; font-size: small; font-weight: bold">Your session has expired, Please login again and then try to generate this report.</span>
</div>
</form>
您的会话已过期,请重新登录,然后尝试生成此报告。
我已经调试了代码。数据从数据库返回,并且报告Div显示在网页上,但没有数据
我做错了什么?报告的最后一行CS代码:
var geofenceData = GETLISTOFGEOFENCEDTO();
GeofenceSummaryReportViewer.ProcessingMode = ProcessingMode.Local;
GeofenceSummaryReportViewer.LocalReport.EnableHyperlinks = true;
GeofenceSummaryReportViewer.HyperlinkTarget = "_blank";
GeofenceSummaryReportViewer.LocalReport.ReportPath = sPath;
GeofenceSummaryReportViewer.LocalReport.DataSources.Add(
new ReportDataSource("GroupGeofenceSummaryReportDataTable", geofenceData ));
GeofenceSummaryReportViewer.LocalReport.EnableExternalImages = true;
GeofenceSummaryReportViewer.LocalReport.Refresh();
GeofenceSummaryReportViewer.LocalReport.Refresh();
尝试将其更改为:
GeofenceSummaryReportViewer.RefreshReport();