title: Using custom Html helpers
body: <p>Trying to use a html helper I found here on the first answer:</p>
  
  <p><a href="https://stackoverflow.com/questions/9030763/how-to-make-html-displayfor-display-line-breaks">enter link description here</a></p>
  
  <p>Heres the controller part:</p>
  
  <pre><code> public static class HtmlHelpers
  {
      public static MvcHtmlString DisplayWithBreaksFor&lt;TModel, TValue&gt;(this HtmlHelper&lt;TModel&gt; html, Expression&lt;Func&lt;TModel, TValue&gt;&gt; expression)
      {
          var metadata = ModelMetadata.FromLambdaExpression(expression, html.ViewData);
          var model = html.Encode(metadata.Model).Replace("\r\n", "&lt;br /&gt;\r\n");
  
          if (String.IsNullOrEmpty(model))
              return MvcHtmlString.Empty;
  
          return MvcHtmlString.Create(model);
      }
  }
  </code></pre>
  
  <p>and in the view I use:</p>
  
  <pre><code>@using HtmlHelpers
  </code></pre>
  
  <p>and </p>
  
  <pre><code>@Html.DisplayWithBreaksFor(m =&gt; m.MultiLineField)
  </code></pre>
  
  <p>But I am getting an error on both </p>
  
  <p>For the first:</p>
  
  <blockquote>
    <p>"The type or namespace name 'HtmlHelpers' could not be found (are you missing a using directive or an assembly reference?)"</p>
  </blockquote>
  
  <p>For the second:</p>
  
  <blockquote>
    <p>"'System.Web.Mvc.HtmlHelper>' does not contain a definition for 'DisplayWithBreaksFor' and no extension method 'DisplayWithBreaksFor' accepting a first argument of type"</p>
    
    <p>"'System.Web.Mvc.HtmlHelper>' could be found (are you missing a using directive or an assembly reference?)"</p>
  </blockquote>