title: Why use EditorFor over PartialView to render a partial view in MVC 4.5+
body: <p>I'm using ASP.NET MVC 4.5+, and I'm trying to understand why one would want to render a partial view utilizing Html.EditorFor rather than Html.PartialView.</p>
  
  <p>What I've found is that EditorFor "respects the model hierarchy", which I've gather to mean that, for an input in a view rendered by EditorFor, input names/ids reflect the nested levels of the calling model, and that PartialViews don't do this.</p>
  
  <p>However, in the following partial view:</p>
  
  <pre><code>@model someModel
  ...
  @Html.TextboxFor(m =&gt; m.complexObject.property)
  ...
  </code></pre>
  
  <p>will render the textbox as </p>
  
  <pre><code>&lt;input id="complexObject_property" name="complexObject.property" ... &gt;
  </code></pre>
  
  <p>when rendered via Html.PartialView, at least in MVC 4.5+.  Which seems to me to be respecting the model hierarchy pretty well.</p>
  
  <p>I understand that DisplayFor and EditorFor will tell the framework to automagically look into the ~/*Templates folder to return views for views called by these controls.  So, the only thing I can think of at the moment is that we'd use Display/EditorFor to allow for this sort of file/folder structure &amp; automagic rendering that is a bit more semantic than looking in a "Shared" folder for a specifically named partial.</p>
  
  <p>As it stands now, even Microsoft's docs seem to imply that Html.EditorFor is intended to be used only to render a single input, not a view: <a href="https://msdn.microsoft.com/en-us/library/system.web.mvc.html.editorextensions.editorfor(v=vs.118).aspx" rel="noreferrer">https://msdn.microsoft.com/en-us/library/system.web.mvc.html.editorextensions.editorfor(v=vs.118).aspx</a></p>