2010-03-08 88 views
0

我試圖在Visual Studio 2008中使用ReportViewer控件,但我在查看「智能標籤面板」時遇到問題。沒有顯示應該在右上角的小三角形。我認爲問題在於我無法在Visual Studio中的Designer中選擇ReportViewer。我該如何解決?Visual Studio ReportViewer控件

否則,我嘗試通過以編程方式填充ReportViewer與數據解決問題,但我也有一些問題在這裏。我得到一個消息,其中顯示了裏面的ReportViewer在rumtime:

一個datasouce例如沒有爲數據源提供...

我使用這個代碼:

private void LoadEmployeeTimeregistrations(string employeeNumber) 
    { 
     _employeeTimeregistrations = new List<TimeregistrationData>(); 
     EntityCollection<TimeregistrationsEntity> employeeTimeregList = 
      _client.TimeRegistrations().GetTimeregistrations(
       KRWindPcClassesLibrary.Properties.Settings.Default.ProjectNumber, 
       employeeNumber, false, null); 

     if (employeeTimeregList != null) 
     { 
      foreach (var timereg in employeeTimeregList) 
      { 
       _employeeTimeregistrations.Add(new TimeregistrationData 
       { 
        Day = timereg.Time.ToShortDateString(), 
        TotalHoursPresentation = 8.ToString() 
       }); 
      } 
     } 

     ReportDataSource reportDataSource = new ReportDataSource("Data", _employeeTimeregistrations); 

     reportViewer2.LocalReport.DataSources.Clear(); 
     reportViewer2.LocalReport.DataSources.Add(reportDataSource); 
     reportViewer2.LocalReport.Refresh(); 
     reportViewer2.RefreshReport(); 
    } 

回答