title: MVC: Set Name Attribute w/Helper
body: <p>I have a situation in an MVC3 app where I would like to be able to set the name attribute on some html being generated by a helper (DropDownList).</p>
  
  <p>It appears this is not possible. Apparently the helpers silently override whatever value you may specify for the name attribute in the html attribute object that you pass to the helper.</p>
  
  <p>I'd like to confirm that before I waste too much more time on trying to work with the existing helpers.</p>
  
  <p>And, as an aside, if it is not possible by design...I think that's a foolish limitation in the MVC framework. Yes, I know that assigning the wrong name attribute can break the automatic model binding. But I should be able to do that when I need to. After all, I can always write the raw html using whatever name attribute I chose. The helpers should help, not be a straitjacket.</p>
  
  <p><strong>Edit to discuss whether editor templates maintain navigational context</strong></p>
  
  <p>Darin, I am using editor templates (I was using the term "partial" generically, since editor templates are a special kind of partial view). </p>
  
  <p>Editor templates <em>do</em> modify the HtmlFieldPrefix -- that's how I noticed I had a problem :). I was using a call like this:</p>
  
  <pre><code>// call in higher level partial - context is 'eae'
  @Html.EditorFor(m =&gt; m.Value)
  ...
  // inside editor template for typeof(Value) context is 'eae:Value'
  </code></pre>
  
  <p>That context shift is needed to keep the default binding mechanism working properly. I'm using a different approach, where I want the context to stay fixed throughout a call chain of partials (i.e., as execution burrows down into deeper partials I want the context to stay the same).</p>