title: Customize DisplayFor output
body: <p>I am making steady progress :)<br>
  So, I have obtained a fantastic grid containing the product list!<br>
  Now, there's a really bad check box that gets displayed for a Boolean value.<br>
  I'd rather have a Yes/No kind of thing. So I googled and found this fantastic article: <a href="http://buildstarted.com/2010/09/10/overriding-displayfor-and-editorfor-to-create-custom-outputs-for-mvc/" rel="nofollow">http://buildstarted.com/2010/09/10/overriding-displayfor-and-editorfor-to-create-custom-outputs-for-mvc/</a> .<br>
  The problem is that the output he's showing is not conditional, so my code
  looks like this:  </p>
  
  <pre><code>@inherits System.Web.Mvc.WebViewPage&lt;string&gt;
  @if @Model == True
  {
    &lt;span&gt;Yes&lt;/span&gt;
  }
  @else{
    &lt;span&gt; No &lt;/span&gt;
  }
  </code></pre>
  
  <p>But VS 2013 is all squiggly about it, which is usually a bad omen!<br>
  When I try to run it, I see the check box. Heh... lots to learn...<br>
  Anyway, I have noticed a similar question to mine, i.e. why the DisplayFor template was not showing. I looked at the OP's code and noticed he had put a DataType attribute that my property did not have (and that now has).<br>
  However, when I tried to use the DataType attribute in my model, VS got all squiggly again - bad omen!<br>
  When I tried to compile, geez, all hell broke loose and I got 6 compile errors (but that's progress at least, from simply ignoring everything!).<br>
  The errors are these:  </p>
  
  <pre><code>Error   1   Expected a "{" but found a "@".  Block statements must be enclosed in "{" and "}".  You cannot use single-statement control-flow statements in CSHTML pages. For example, the following is not allowed:
  
  @if(isLoggedIn)
      &lt;p&gt;Hello, @user&lt;/p&gt;
  
  Instead, wrap the contents of the block in "{}":
  
  @if(isLoggedIn) {
      &lt;p&gt;Hello, @user&lt;/p&gt;
  }   c:\Users\Andrea\Documents\Visual Studio 2013\Projects\ARSoftLabs.it\ARSoftLabs.it\Views\Products\DisplayTemplates\ProductHasTrial.cshtml    2   4   ARSoftLabs.it
  Error   2   ) expected  c:\Users\Andrea\Documents\Visual Studio 2013\Projects\ARSoftLabs.it\ARSoftLabs.it\Views\Products\DisplayTemplates\ProductHasTrial.cshtml    1   1   ARSoftLabs.it
  Error   3   Syntax error, '(' expected  c:\Users\Andrea\Documents\Visual Studio 2013\Projects\ARSoftLabs.it\ARSoftLabs.it\Views\Products\DisplayTemplates\ProductHasTrial.cshtml    2   4   ARSoftLabs.it
  Error   4   Invalid expression term 'else'  c:\Users\Andrea\Documents\Visual Studio 2013\Projects\ARSoftLabs.it\ARSoftLabs.it\Views\Products\DisplayTemplates\ProductHasTrial.cshtml    6   2   ARSoftLabs.it
  Error   5   The type or namespace name 'DataTypeAttribute' could not be found (are you missing a using directive or an assembly reference?) c:\Users\Andrea\Documents\Visual Studio 2013\Projects\ARSoftLabs.it\ARSoftLabs.it\Models\Product.cs 20  10  ARSoftLabs.it
  Error   6   The type or namespace name 'DataType' could not be found (are you missing a using directive or an assembly reference?)  c:\Users\Andrea\Documents\Visual Studio 2013\Projects\ARSoftLabs.it\ARSoftLabs.it\Models\Product.cs 20  10  ARSoftLabs.it
  </code></pre>
  
  <p>So basically I think it's telling me I don't know jack about Razor, which is quite frankly true. Anyway, the System.ComponentModel is being used because the DisplayName attribute works like a charm and MSDN claims that DataType is in the same assembly. </p>
  
  <p>Ideas? Pointers?</p>
  
  <p>Thanks!</p>
  
  <p>A</p>