2010-03-08 91 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(); 
    } 

回答