title: Jquery treeview nodes will not toggle after an ajax call
body: <p>I have two dialog boxes within my view.  Each of these dialog boxes have ajax commands within them for instance the first one does a <code>POST</code> and second one does a <code>LOAD</code>. </p>
  
  <p>The issue is after I select from a checkbox list in dialog box 1 and hit UpdatePage button, my model gets updated just fine.  However, The second dialog box containing the tree view with another checbobox list/nodes will not toggle at all. It does retain its previous state though: The checkboxes selected previosuly are checked but it will not toggle at all.  </p>
  
  <p>The following function creates the dialog box 1 and upon successful completion of the post command in this dialog box that the second dialog box and the treeview within, will not toggle.</p>
  
  <pre><code>function initDailog() {
  
          RunDialog = $("#runDatestreeview").dialog({ closeOnEscape: true, stack: false, autoOpen: true,
              modal: false, resizable: true, draggable: true, title: 'Select Run Dates to Auto-Populate Form Fields &amp; Test Exceptions:',
              width: 600, height: 500, position: 'center',
              open: function (type, data) {
              },
              buttons: { UpdatePage: function () {
                  //storing the value of treeview selections in dialog box 2
                  var originalContent = $("#treeview").html();
                  $.post(runDatesUrl,
                $("#form").serialize(),
                 function (data) {
                     $("#runDatestreeview").remove();
                     //removing the div which contains the treeview
                     $("#treeview").remove();
                     $("#testExceptiontreeview").remove();
                     $("#main").html(data);
                    //setting back the value of the div which contains the treeview 
                     $("#treeview").html(originalContent);
                 }, "html");
              },
                  Cancel: function () {
                      $(this).dialog("close");
                                        }
              }
          });
  
          RunDialog.closest("div.ui-dialog").appendTo("#form");
      }
  </code></pre>
  
  <p>Treeview defined in dialog box 2, in its seperate JS file:</p>
  
  <pre><code>$("#errorCodes ul").treeview({
  collapsed: true,
  prerendered: false
  });
  </code></pre>
  
  <p>The HTML for The div which contains the tree view:</p>
  
  <pre><code>&lt;div id="treeview" title="Dialog Title" style="font-size: 10px; font-weight: normal;
      overflow: scroll; width: 800px; height: 450px; display: none;"&gt;
      &lt;div id="errorCodes"&gt;
          @Html.RenderTree(CacheHelper.ErrorCodes(), ec =&gt; ec.Name, ec =&gt; ec.Children.ToList(), ec =&gt; (ec.ID).ToString(), null, "e")
      &lt;/div&gt;
      &lt;div id="inputReps" style="display: none;"&gt;
      &lt;/div&gt;
  &lt;/div
  </code></pre>