Another sub-report binding question

2 posts, 0 answers
  1. Michael Eaton
    Michael Eaton avatar
    7 posts
    Member since:
    Jan 2006

    Posted 07 Feb 2013 Link to this post

    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.
  2. Michael Eaton
    Michael Eaton avatar
    7 posts
    Member since:
    Jan 2006

    Posted 07 Feb 2013 Link to this post

    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.
  3. DevCraft banner
Back to Top