title: How do you access the DisplayNameFor in a nested model
body: <p>How do you access the <code>DisplayNameFor</code> in a nested model - ie.:</p>
  
  <pre><code>public class Invoice
  {
      public int InvoiceId { get; set; }
      public string CustomerName { get; set; }
      public string Contact { get; set; }
      public IList&lt;InvoiceItem&gt; InvoiceItems { get; set; }
  }
  
  public class InvoiceItem
  {
      public int InvoiceItemId { get; set; }
      public int InvoiceId { get; set; }
      [Display(Name = "Item Heading")]
      public string Item { get; set; }
      [Display(Name = "Item Description")]
      public string Description { get; set; }
      public virtual Invoice Invoice { get; set; }
  }
  </code></pre>
  
  <p>I can loop through the nested items as follows:</p>
  
  <pre><code>     @foreach (var item in Model.InvoiceItems)
       {
            @Html.DisplayFor(modelItem =&gt; item.Item)
            &lt;br /&gt;
            @Html.DisplayFor(modelItem =&gt; item.Description)
            &lt;br /&gt;
       }  
  </code></pre>
  
  <p>But I how do I get to: <code>[Display(Name = "Item Heading")]</code></p>
  
  <pre><code>@Html.DisplayNameFor(modelItem =&gt; modelItem.Item)
  </code></pre>
  
  <p>I get the error: <code>'inv5.Models.Invoice' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'inv5.Models.Invoice' could be found</code></p>
  
  <p>Thanks, Mark</p>