This is a migrated thread and some comments may be shown as answers.

ObjectDataSource and Lists in Subreport

3 Answers 143 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Emil Einarsson
Top achievements
Rank 1
Emil Einarsson asked on 26 Nov 2010, 01:46 PM
Hello.

Lets say you have a report for an Invoice.

You programmatically instantiate the report and set its Datasource to a Invoice object.

The invoice has properties like number, adress, whatever. But it also has a list of InvoiceLines.

Can the "Main" report have an invoice object as DataSource, and then have a subreport in the details-section that is bound to the List of Invoice lines?

EDIT: This is all done programatically, to be able to create a pdf. :)

Cheers,
E

3 Answers, 1 is accepted

Sort by
0
Emil Einarsson
Top achievements
Rank 1
answered on 26 Nov 2010, 02:26 PM
Nvm, find my own solution to this now. By just setting the subreports datasource manually to the list. But maybe there is a smarter way so I won't need to do that.
0
net logging
Top achievements
Rank 1
answered on 09 Mar 2011, 10:13 PM
Do you have a sample solution? I have been trying to get this working for a while.

Much appreciated.

0
Emil Einarsson
Top achievements
Rank 1
answered on 10 Mar 2011, 08:32 AM
I have a main report

It's called InvoiceReport.

Its details section has a subReport.

So all I do is to create an InvoiceReport and an InvoiceLinesReport.

Then I set InvoiceLinesReport.DataSource = my List<InvoiceLine>

Then InvoiceReport.subReport.ReportSource = InvoiceLinesReport.

That's it. Hope it's clear enough. :)
Tags
General Discussions
Asked by
Emil Einarsson
Top achievements
Rank 1
Answers by
Emil Einarsson
Top achievements
Rank 1
net logging
Top achievements
Rank 1
Share this question
or