VS 2010 Bug ! MS ReportViewer with Nested Objects Data Sources
There is a big bug in Visual Studio 2010 if you use MS ReportViewer and .rdlc file with Nested Objects Data Sources.
In old VS version , the Nested Objects data source worked. Just read this article first:
Sample on ReportViewer controls with Object data sources containing nested objects
Tudortr made it worked in 2006:
For example, Here we have a class:
public class HUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class AnalogReportObj
{
public int PointNumber { get; set; }
public HUser ManUser { get; set; }
}
then you can use "=Fields!AnalogReportObj.ManUser.Value.LastName" in .RDLC file textbox to get nested object value . But in Visual Studio 2010, the above syntax to access nested properties no longer works. Microsoft stuff said they will fix this bug in VS 2010 SP1.
Microsoft HotFix:
Accessing Nested Objects in Data Source of Local Report Does Not Function
Brian Hartman's Report Viewer Blog: Nested Objects in Local Mode
For old version, some friend had his experience if doesn't work: