title: How to create an Editor Template for Boolean? (.EditorFor<>)
body: <p>I'm trying to define a Boolean.cshtml to use with EditorFor using the following code:</p>
  
  <pre><code>@{
     var o = ViewData.ModelMetadata;
  }
  
  &lt;div class="editor-for"&gt;
      @Html.CheckBox(o.PropertyName,
                     ViewData.Model,
                     new { @class="tickbox-single-line" })
  &lt;/div&gt;
  </code></pre>
  
  <p>Unfortunately, Model is null and I get the following non-descriptive error:</p>
  
  <blockquote>
    <p>CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named 'CheckBox' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.</p>
  </blockquote>
  
  <p>After reading this I tried the following:</p>
  
  <pre><code>@Html.CheckBox(o.PropertyName,
                 ViewData.Model ?? false,
                 new { @class="tickbox-single-line" })
  </code></pre>
  
  <p>But I get exactly the same error. The View code is simply:</p>
  
  <pre><code>@Html.EditorFor(m =&gt; m.RememberMe)
  </code></pre>
  
  <p>What am I doing wrong in Boolean.cshtml?</p>