title: update .html with @HTML helper DropDownList
body: <p>MVC4, C#, jQuery, Razor view (.cshtml) </p>
  
  <p>I'm trying to update the .html() of a node with a @HTML.DropDownList:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $('#CmpMASttF').html('@Html.DropDownList("CmpAdrsSt.State", (IEnumerable&lt;SelectListItem&gt;)ViewBag._State) @Html.ValidationMessageFor(m =&gt; m.CmpAdrsSt.State) '); 
  &lt;/script&gt;
  </code></pre>
  
  <p>This works fine for a @HTML.EditorFor:</p>
  
  <pre><code>$('#CmpMASttF').html('@Html.EditorFor(m =&gt; m.CmpAdrsSt.State) @Html.ValidationMessageFor(m =&gt; m.CmpAdrsSt.State) ');
  </code></pre>
  
  <p>This is the node being updated:</p>
  
  <pre><code>        &lt;tr class="CmpMA"&gt;&lt;td tate: &lt;/td&gt;
          &lt;td  colspan="4" &gt;&lt;span id="CmpMASttF" class="editor-field"&gt;&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>The @HTML.DropDownList code works fine by itself so that is not the source of the problem:</p>
  
  <pre><code>        &lt;tr&gt;&lt;td&gt;State: &lt;/td&gt;
          &lt;td  colspan="4"&gt;&lt;span class="editor-field"&gt;
                @Html.DropDownList("CmpAdrsSt.State", (IEnumerable&lt;SelectListItem&gt;)ViewBag._State)
                @Html.ValidationMessageFor(m =&gt; m.CmpAdrsSt.State)&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>When I try and update the node with the @HTML.DropDownList with the jQuery .html() all the code in the javascript block is disabled.</p>
  
  <p>I tried encoding the string:</p>
  
  <pre><code>var test = '@Ajax.JavaScriptStringEncode("Html.DropDownList(\"CmpAdrsSt.State\",(IEnumerable&lt;SelectListItem&gt;)ViewBag._State)")'
  </code></pre>
  
  <p>but when injected into the .html() it renders as a string not a HTML DropDownList helper (adding the @ before HTML, "@HTML.DropDownList ..., makes no difference).</p>
  
  <p>How do you update the .html() of a node with a @HTML.DropDownList? </p>
  
  <p>Thank you</p>