title: How to Use @Html.EditorFor() without the view model
body: <p>I want to do something like this so I can create a modal dialog that I'll invoke late with jQuery</p>
  
  <pre><code>&lt;div class="modal" id="modalName" style="display: none;"&gt;
  &lt;div class="modal-header"&gt;
      &lt;a class="close" data-dismiss="modal"&gt;×&lt;/a&gt;
      &lt;h3&gt;Edit Contacts&lt;/h3&gt;
  &lt;/div&gt;
  @using (Html.BeginForm("Index", "Home", FormMethod.Post, new Dictionary&lt;string, object&gt; { { "class", "form-horizontal" } }))
  {
      &lt;div class="modal-body"&gt;
      @Html.EditorFor(model =&gt; new ViewModel(), "ViewModelTemplateName")
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
          &lt;a href="#" class="btn" data-dismiss="modal"&gt;Close&lt;/a&gt;
          &lt;button type="submit" class="btn btn-primary"&gt;
              Submit&lt;/button&gt;
  
      &lt;/div&gt;
  }
  &lt;/div&gt;
  </code></pre>
  
  <p>On this line</p>
  
  <pre><code>@Html.EditorFor(model =&gt; new ViewModel(), "ViewModelTemplateName")
  </code></pre>
  
  <p>I get the error</p>
  
  <blockquote>
    <p>Templates can be used only with field access, property access,
    single-dimension array index, or single-parameter custom indexer
    expressions.</p>
  </blockquote>
  
  <p>I don't understand why it would care where or what the instance is (as long as its the right type)</p>
  
  <p>@Html.Partial("~/Views/Shared/EditorTemplates/ViewModel.cshtml", new ViewModel()) does the trick, but I have to declare the full path the the template...this sucks a bit.</p>
  
  <p>so is there a better way to do it?</p>