2014-11-10 6 views
0

Я прочитал все Ответы Ответы, которые я мог найти, но ни одна из них не решила мою проблему.Отчет 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 string StartDateTime { get; set; } 

    public string EndDateTime { get; set; } 

    public string GeofenceId { get; set; } 

    public string GeofenceEvent { get; set; } 

    public string EventDateTime { get; set; } 

} 

Чтение данных из БД и преобразования в список 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" 

            }); 
       } 

Мой отчет 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(); 

Data Set in Report

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 отображается на веб-странице, но нет данных.

Что я делаю неправильно?

ответ

0

Последняя строка вашего сообщения CS Код:

GeofenceSummaryReportViewer.LocalReport.Refresh(); 

Попробуйте изменить его к этому:

GeofenceSummaryReportViewer.RefreshReport(); 
Смежные вопросы