开发者

How to display a child List inside of the DataSource in VS Report Viewer 2008?

I have created a static Generic List (List) and bind it to a Report Viewer's data source. In the Report Viewer designer, I 开发者_开发问答am able to find the correct data source which is List and also able to drag and drop properties like ProductName, ProductNo from a single Product object onto the report.

However, this Product object itself contains another List (List). My question is how I can get the objects from this inner List and display them onto the report?

Any help would be much appreciated!


2 ways:

  1. If the actual second list is related to the first list, that is you have some sort of join on a OneSideTable.ID = ManySideTable.ID. In that case your reports group would be by the OneSideTable.ID and the child records would be placed in the details section so that you get something to this effect:
Product: Ford
    -Focus
    -Mustang
    -Edge
    -Escape
    -Taurus    Product: GM
    -Accadia
    -Cobalt
    -HHR    ....
    ...

TWO. The other way to do it is you could have a second data source and drag and drop another table / list object onto the report. You would tell this object to take on the second datasource dsSecond. Then you can drag and drop your fields from this second dataset into this table / list of the report.

Very simple!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜