views:

39

answers:

2

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?

+1  A: 

I had the exact same problem, and I'm sorry to say that I haven't found a way to reference sub-properties (I do hope that someone else has one though!)

What I ended up doing is creating a wrapper class that has all the properties I need directly in it.

Meta-Knight
+1  A: 

The following syntax seems to work.

=Fields!Address.Value.HomeAddress1
matt