title: mvc3 .net Display View Template using Html.DisplayFor
body: <p>I'm trying to use templates.</p>
  
  <p>I'm having trouble using using the Html.DisplayFor extension</p>
  
  <p>I want the template to display all the data as read-only.  I believe that HTML.DisplayFor can do this?</p>
  
  <p>If this is so, I have a IEnumerable model being passed to the view:</p>
  
  <pre><code>@model IEnumerable&lt;Tens.Models.Applicant&gt;
  
  @{   
      if (Model != null)
      {  
            @Html.DisplayForModel("ApplicationOutcome") 
      } 
   }
  </code></pre>
  
  <p>and my Template:</p>
  
  <pre><code>@model IEnumerable&lt;Tens.Models.Applicant&gt;
  
  @{
  
  foreach(var item in Model)
  {
      @Html.TextBox("forenames",item.Forenames)
      &lt;br /&gt;
      @Html.TextBox("surname",item.Surname)
      &lt;br /&gt;
      &lt;text&gt;----------------------------------&lt;/text&gt;
      &lt;br&gt;
  }
  }
  </code></pre>
  
  <p>The above code works fine (2 records displayed) but it would mean me setting each fields readonly attribute to true (there are a load more fields - so tedious).
  What I want to do is use Html.DisplayFor to display this data as readonly, but I've tried numerous different ways and can't get it to work.
  Any help is appreciated.</p>