If I assign a collection of objects to a ReportViewer's DataSource, how can I view one report page per object?
Let's say I have code like this that sets ReportViewer's DataSource:
var invoice1 = new Invoice() { InvoiceNbr = 1 };
var invoice2 = new Invoice() { InvoiceNbr = 2 };
InvoiceBindingSource.DataSource = new List<Invoice>() { invoice1, invoice2 };
reportViewer1.RefreshReport();
Assume reportViewer1 is bound to a very simple RDLC report bound to my Invoice custom class. The report has a single textbox bound to the InvoiceNbr property.
My problem: If I run this code, ReportViewer only shows 1 page, not two. Only InvoiceNbr 1 is shown.
Thoughts: If I execute this code, the report's textbox bound to the InvoiceNbr property must be an aggregate value, like =First(Fields!InvoiceNbr.Value, "InvoiceGraphDataset") ---note: if I instead use Fields!InvoiceNbr.Value, I get a design-time error stating the value must be an aggregate expression.
My question reiterated: So, how do I get two report pages in my ReportViewer showing InvoiceNbr 1 on a page and InvoiceNbr 2 on a different page? I can do this easily in MS Access.
Edit: I'm terrified this is the only answer. Can someone confirm there's a better way than creating a table-row w/ page breaks report? It seems like there should be a more intuitive way to make one report page per Invoice object. Help?