title: ASP.NET MVC grid/table
body: <pre><code>public class Person
  {
      public string First { get; set; }
      public string Last { get; set; }
      public int Age { get; set; }
      public IEnumerable&lt;Child&gt; Children { get; set; }
  }
  
  public class Child
  {
      public string First { get; set; }
      public string Last { get; set; }
      public int Age { get; set; }
  }
  </code></pre>
  
  <p>I'm searching for a way to render a table from my model, which is of type <code>IEnumerable&lt;Person&gt;</code>.  I'm trying to generate the following table:</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr class="person"&gt;
          &lt;td&gt;First 1&lt;/td&gt;
          &lt;td&gt;Last 1&lt;/td&gt;
          &lt;td&gt;1&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="child"&gt;
          &lt;td&gt;First 1&lt;/td&gt;
          &lt;td&gt;Last 1&lt;/td&gt;
          &lt;td&gt;1&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="child"&gt;
          &lt;td&gt;First 2&lt;/td&gt;
          &lt;td&gt;Last 2&lt;/td&gt;
          &lt;td&gt;2&lt;/td&gt;
      &lt;/tr&gt;
      ...
      ...
  &lt;/table&gt;
  </code></pre>
  
  <p>Each person is a row and each of their children would be individual rows under the person row.  This would repeat for each person in <code>IEnumerable&lt;Person&gt;</code>.</p>
  
  <p>Are there any grids or components that generate a table like this? I found <a href="http://mvccontrib.codeplex.com/wikipage?title=Grid" rel="nofollow">MvcContrib's grid component</a>, but it doesn't appear to be able to generate these child rows.  Is there a way to extend MvcContrib's grid to do this?</p>