【发布时间】:2010-03-08 13:12:06
【问题描述】:
我正在尝试在 Visual Studio 2008 中使用 ReportViewer 控件,但在查看“智能标记面板”时遇到问题。应该在右上角的小三角形没有显示出来。我认为问题在于我无法在 Visual Studio 的设计器中选择 ReportViewer。我该如何解决这个问题?
否则,我试图通过以编程方式在 ReportViewer 中填充数据来解决问题,但我在这里也遇到了一些问题。我收到一条消息,该消息在 rumtime 显示在 ReportViewer 中:
尚未为数据源提供数据源实例...
我正在使用此代码:
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();
}
【问题讨论】:
标签: c# visual-studio reportviewer