Sample on ReportViewer controls with Object data sources containing nested objects

I made a couple of changes in the object data source sample on www.gotreportviewer.com to illustrate the use of nested objects in report fields

I have added a ProductSales sub-class to the Product class. ProductSales has two fields: Quantity and Price.

In the report - you can reference them via:

Fields!Sales.Value.Quantity and Fields!Sales.Value.Price

You can similarly use multiple levels of object nesting, for example:

Fields!Sales.Value.Customer.Name

See attachment for details.

.

NestedObjectDatasources.zip

Comments

  • Anonymous
    April 18, 2006
    Question: Utilizing an object graph as the given data source is there anyway to allow the Lists / Matrix / and or Table, within the given report, to utilize / bind to child collections vs. having to use a sub-report just to contain said table / and or matrix…?  And if so, then within a given List having a contained List utilizing yet another contained collection of an item within the parent collection…

    Cheers,

    Robert

  • Anonymous
    November 17, 2006
    You may need to make sure that your report is executing within your AppDomain in order for the report to access the fields of the nested object.  The following code snippet shows how to do this: {reportObjectViewerObject}.LocalReport.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetExecutingAssembly().Evidence);

  • Anonymous
    December 01, 2006
    If you strong name your assemblies it wont work if you to use nested objects. Only thing that will show in your table is #Error.

  • Anonymous
    March 06, 2007
    前两篇Blog提到的问题得到了Reporting Service项目组Tudor的答复: 1.gotreportview上两个例子的疑问。 LocalReport.DataSources takes a