DataSource Binding Order of Operations?

2 posts, 0 answers
  1. Xorcist
    Xorcist avatar
    92 posts
    Member since:
    Apr 2009

    Posted 04 Mar 2014 Link to this post

    So we have used the standalone designer to create a report, we are using an ObjectDataSource (and access method of that object to return data). This works completely fine, and we are able to preview our test data while designing the report.

    In our web application we deserialize the report file (*.trdx) in order to change the report DataSource and use real data like this:

          XmlReaderSettings settings = new XmlReaderSettings() { IgnoreWhitespace = true };
          Telerik.Reporting.Report rpt;
          String file = Server.MapPath("~/Reports/OurReport.trdx");
          using (XmlReader xmlReader = XmlReader.Create(file, settings)) {
            ReportXmlSerializer xmlSerializer = new ReportXmlSerializer();
            rpt = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
          InstanceReportSource ReportSource = new InstanceReportSource();
          ReportSource.ReportDocument = rpt;
          ReportSource.ReportDocument.Reports.FirstOrDefault().DataSource = GetData();

    What I am unclear about, is whether or not the report goes through the process of loading up all our test data first, before we acquire the real data (i.e. GetData()) and assign it to the DataSource. If we comment out the DataSource assignment we'll see the test data displayed in the report viewer, which makes me wonder. I definitely don't want the report to go through the trouble of generating data that is just going to be overwritten. Can someone clue me in on the order of operations in regards to this, so we can avoid any unnecessary overhead.

  2. Stef
    Stef avatar
    2932 posts

    Posted 07 Mar 2014 Link to this post


    With the given code you are modifying the report definition. If the DataSource is not reassigned, the definition remains unchanged. Later on processing of the report there will be loaded only the data set by definition.

    For more details check the Report Life Cycle article.

    Let us know if you have any further questions.


    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

  3. DevCraft banner
Back to Top