title: Outputting HTML without using MVC helper
body: <p>I have one view which outputs a list of data from a database, one of those fields is an image which is uploaded via my website. I output the image like so:</p>
  
  <pre><code>&lt;img src='@item.ToBase64ImageString(@item.FileData)' /&gt;
  </code></pre>
  
  <p>And in my model I have:</p>
  
  <pre><code>    public string ToBase64ImageString(byte[] data)
      {
          return string.Format("data:image/jpeg;base64,{0}", Convert.ToBase64String(data));
      }
  </code></pre>
  
  <p>I have another view where it's purpose is just to show details of the selected item (Controller/Details/id) and I would like to show the image in this view too.</p>
  
  <p>I am unable to use the code from above as I do not have an individual item in @item - I have @model but for some reason this approach does not work.</p>
  
  <p>Here is the details view:</p>
  
  <pre><code>@model Models.Tier
  
  @Html.DisplayNameFor(model =&gt; model.FileData)
  &lt;img src="@Html.DisplayFor(model =&gt; model.ToBase64ImageString(model.Bild))" /&gt;
  </code></pre>
  
  <p>In short, how can I output HTML for a model field without using the helpers?</p>