title: Microsoft Reporting with Collection as DataSource
body: <p>I'm working with <strong>MS Reporting Services</strong>. The underlying datasource is </p>
  
  <p><code>IEnumerable&lt;MyObject&gt;</code>, I'm not using DataSets.</p>
  
  <p>Every <code>MyObject</code> has properties and some other <code>IEnumerable</code> collections.
  In the report I want to display all the properties from <code>MyObject</code> and
  the collections lists too.
  I didn't know how to display this inner collections, so I've made a <strong>SubReport</strong> to which I passed the <code>MyObject</code>.Id so that the SubReport could retrieve the object by himself and Build a the DataSource for these inner collections.
  I do this in this event.</p>
  
  <pre><code>myReportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
  
  private void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
  {
      int id;
      if (e.Parameters.Count &gt; 0 &amp;&amp; int.TryParse(e.Parameters[0].Values[0], out id))
      {
          MyObject current = myObjects.Where(x =&gt; x.MyObject.Id == id).FirstOrDefault();
  
          InnerListBindingSource.DataSource = current.InnerCollection;
          e.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource(
              "MyInnerCollectionDataSource", InnerListBindingSource));
      }
  }
  </code></pre>
  
  <p>But there is always "The SubReport could not be shown" in my Master Report.
  (Master report - subreport are correctly binded)</p>
  
  <p>Any Idea why? Or how to resolve this in a more elegant way ? </p>
  
  <p>Thank you</p>