title: How can I truncate a string using MVC Html Helpers?
body: <p>I am trying to truncate a long string for display only on my index page.  It is shown like so:</p>
  
  <pre><code>&lt;td&gt;
      @Html.DisplayFor(modelItem =&gt; item.Description)
  &lt;/td&gt;
  </code></pre>
  
  <p>The Description can be 500 characters long but I can't show that much on that grid layout.  I'd like to show just the first 25 as they can see all of it on the Details page but I cannot seem to get it to work with out truncating it at the model level.</p>
  
  <p>Something like this would be nice:</p>
  
  <pre><code>@Html.DisplayFor(modelItem =&gt; item.Description.Take(25))
  @Html.DisplayFor(modelItem =&gt; item.Description.Substring(0,25)
  </code></pre>
  
  <p>EDIT</p>
  
  <p>I'm getting the following exception at Runtime when I try either method.</p>
  
  <pre><code>Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
  </code></pre>