Features of .NET ReportViewer: Displaying Multiple Rows

Situation : We developed an attractive report page using the .NET ReportViewer (ASP.NET, RDLC) with a custom object from our object model. My main (and possibly incorrect) assumption was that if we linked the collection to custom objects in ReportViewer / RDLC, the control would build a populated report layout for each object in the collection.

My experience with past reports is related to the MS-Access report engine, where linking a data source to a report will cause the report layout to be used to write each in the data source. If the report layout covers the entire page, for example, a page with a filled report will be created for each related record.

Question : My colleague tells me that .NET ReportViewer cannot function as I describe. Indeed? Please tell me that he is wrong? Any recommendations for a solution or workaround?

Thanks in advance, -JR

NOTE. The original title of the question has changed in response to an explanatory answer.

+4
source share
2 answers

Short answer: Yes . ReportViewer can behave as you describe. (Your colleague is wrong.)

There are several approaches for displaying all rows in a data source, not just the first one. I am most familiar with the List Control approach, which is described here, but there is also a Master-Detail approach, using either nested data or nested data regions.

Strictly speaking, this question is about displaying multiple rows of data, not collections of user objects. You might want to change the title of the question from ".NET ReportViewer Features: Binding to Custom Object Collections"? say ".NET ReportViewer Features: Displaying Multiple Rows"?

When developing a report, if you put a field from the data source in the report designer and display the report, you notice that only one row is displayed, and not the entire data set. Upon closer inspection, ReportDesigner wrapped the First () aggregate function around your data field. This is the default behavior for ReportViewer.

What you want to do is use the List control and put your data controls in it. Now all rows of fields will be shown. It is so simple.

A list is an essential component to using ReportViewer successfully. Read it. A list can handle greater complexity using the capabilities of Group Expression, as well as by placing List / Table controls on it.

Resources

As mentioned in another post, one of the best web resources for ReportViewer is the GotReportViewer site. There you will find additional information about using List, Master-Detail, and others.

Good luck.

+4
source

You can find your solution here: http://www.gotreportviewer.com/

more details here about binding custom classes / collections http://www.gotreportviewer.com/objectdatasources/index.html

I do not think rdlc creates layouts for you.

+1
source

All Articles