Search code examples
vb.netasp.net-2.0report

Subfield values in .NET Local Report


I'm attempting to use business objects as a datasource for an ASP.NET Microsoft rdlc Report and I am having problems displaying the values of subobjects in the report.

For example, if have the following two classes 'Customer' and 'Address'.

Customer
    FirstName
    LastName
    Address
    etc.

Address
    HomeAddress1 
    etc.

Customer contains an instance of Address. If I set a list of Customers as the report datasource, I can refer to the values of each customer in the report as follows:

=Fields!FirstName.Value

However, I can't work out how to refer to the values of the 'Address' sub-object. I had assumed one of the following would work:

=Fields!Address.HomeAddress1.Value

or

=Fields!Address!HomeAddress1.Value

But neither of these do. Can anyone advise?


Solution

  • The following syntax seems to work.

    =Fields!Address.Value.HomeAddress1