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

梦想与她 提交于 2019-12-12 04:34:49

问题


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!


回答1:


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!



来源:https://stackoverflow.com/questions/1977947/how-to-display-a-child-list-inside-of-the-datasource-in-vs-report-viewer-2008

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!