child objects in rdlc (Studio 2010RC)

Jim picture Jim · Mar 31, 2010 · Viewed 7.7k times · Source

I am attempting to reference a sub-object in a field expression in a studio 2010 report. This used to work in prior versions. When account references another object with properties the following used to work.

=Fields!Account.Value.Name

(Name is a property of the child object, Account is the parent object)

The same expression syntax no longer works. How do I reference the properties of a sub-object in reporting services in an rdlc in studio 2010.

Thanks

Answer

alanning picture alanning · Oct 16, 2011

I can confirm that this bug has been fixed in VS2010 SP1 ... but you have to mark all of the relevant classes as Serializable.

You can find a sample project on this site which shows a working version: http://wraithnath.blogspot.com/2011/04/reportviewer-object-datasource-nested.html

The author also mentions that your classes will need a parameterless constructor but I have gotten it to work using classes without a default constructor. Still, if you have marked everything as serializable and are still seeing the "#Error" message, give it a try with parameterless constructors.