Visual Studio ReportViewer Control
I'm trying to use the ReportViewer Control in Visual Studio 2008 but I'm having problems with viewing the "Smart Tag Panel". The little triangle which should be in the top right corner is not shown. I think the problem is that I can't select the ReportViewer in the Designer in Visual Studio. How do I fix this?
Otherwise i tried to sholved the problem by filling the ReportViewer with data programatically but i also have some problems here. I get an message, which is shown inside the ReportViewer at rumtime:
A datasouce instance have not been supplied for the data source ...
I'm using this code:
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()
});
}开发者_StackOverflow社区
}
ReportDataSource reportDataSource = new ReportDataSource("Data", _employeeTimeregistrations);
reportViewer2.LocalReport.DataSources.Clear();
reportViewer2.LocalReport.DataSources.Add(reportDataSource);
reportViewer2.LocalReport.Refresh();
reportViewer2.RefreshReport();
}
See this website:
http://www.gotreportviewer.com/
It should have all of the information that you require regarding setting a datasource (amongst many, many other things) for the ReportViewer for VS 2008.
精彩评论