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

Another sub-report binding question

1 Answer 55 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael Eaton
Top achievements
Rank 1
Michael Eaton asked on 07 Feb 2013, 03:57 PM
I am binding my main report to an instance of an object that looks like this:

public class foo {
    public Bar Header { get;set; }
    public List<Baz> ListOfStuff { get;set;}
}

I have a sub-report that will display .ListOfStuff, but I'm at a loss on how to bind the sub-report so it has access this data from the main report.

At a high-level, this is how my main report is binding to the original source:

                var report = new TestReport();
                var ods = new Telerik.Reporting.ObjectDataSource();
                ods.DataSource = instanceOfFoo;
                report.DataSource = ods;
               
                instanceReportSource.ReportDocument = report;
                ReportViewer.ReportSource = instanceReportSource;

My sub-report doesn't have a DataSource set, so I've tried using NeedDataSource, but I'm not sure what exactly I need to do to bind to the parent data.

I'm sure I'm missing something really simple, but at this point, I'm stuck.

1 Answer, 1 is accepted

Sort by
0
Michael Eaton
Top achievements
Rank 1
answered on 07 Feb 2013, 04:18 PM
Solved.

It boils down to me being an idiot. :-)

I was fetching my data from a service. The service was returning data in a slightly different format than I was expecting.

Binding works as expected.

In my sub-report, I simply added a binding that looks like:

DataSource, ="ReportItem.Parent.DataObject"

and my sub-report has the data I need.
Tags
General Discussions
Asked by
Michael Eaton
Top achievements
Rank 1
Answers by
Michael Eaton
Top achievements
Rank 1
Share this question
or