title: How to access the Model from the View?
body: <p>I have a search page that display a search result. The search result is a list of persons that matched the specific search. I'm iterating through this list displaying them in a table. As headers for this table I want the DisplayName from the model. If I don't inherit IEnumerable I wouldn't be able to iterate through the list. I'm new at this MVC thing =)  </p>
  
  <p>I iterate through the result like this:    </p>
  
  <pre><code>&lt;% foreach (var item in Person) { %&gt; 
     &lt;%: item.surname %&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>But how do I print the "DisplayName" of an attribute without iterating through the whole list? I would just like to do:  </p>
  
  <pre><code>&lt;%: Html.LabelFor(m =&gt; m.surname) %&gt;
  </code></pre>
  
  <p>If it's any help I inherit an IEnumerable at the top of the page:</p>
  
  <pre><code>&lt;%@ Page Inherits="System.Web.Mvc.ViewPage&lt;IEnumerable&lt;RegistryTest.Models.Person&gt;&gt;" %&gt;  
  </code></pre>
  
  <p><strong>Edit</strong><br>
  I want to display "Your surname" but I don't know how to access it from the view.  </p>
  
  <pre><code>[DisplayName("Your surname")]
  public object surname { get; set; }  
  </code></pre>
  
  <p>Here's a very similar question that hasn't been answered either: <a href="https://stackoverflow.com/questions/4041385/can-i-use-labelfor-when-the-page-inherits-from-ienumerablet">Can I use LabelFor() when the page inherits from IEnumerable&lt;T&gt;?</a></p>