title: Problems with a JQuery dialog displaying a blank window when updating .html() inside with MVC
body: <p>I'm having a problem with a JQuery dialog being empty when displayed. I know what the problem is but can't figure out how to fix it. I hope to find some help here.</p>
  
  <p>Issue:</p>
  
  <p>I have a page with a simple list of users. Every item/user on the list has an EDIT link. When clicked edit a dialog box pops up with details for that user. Great! Sounds simple enough.</p>
  
  <p>So the user list initializes the partial view that'll be a dialog box:</p>
  
  <pre><code>@Html.Partial("EditUser", new User())
  </code></pre>
  
  <p>That pre-loads the partial view and the dialog is initialized with a regular:</p>
  
  <pre><code>$(function () {
      $("#edit-user-dialog").dialog({
          title: "Edit User",
          autoOpen: false,
          height: 500,
          width: 600,
          modal: true
      });
  });
  </code></pre>
  
  <p>So far so good...</p>
  
  <p>The partial view itself is a regular page with Ajax form submit that allows me to submit modified user info. Everything associated to that popup, such as its DIV, connected JScripts must be contained within just so information could be easily found later. Here is the sample code of the Partial View that will be displayed as a dialog:</p>
  
  <pre><code>@model MyNamespace.User
  &lt;script src="@Url.Content("~/myUserEditScriptScripts.js")" type="text/javascript"&gt;&lt;/script&gt;
  
  &lt;div id="edit-user-dialog" style="display: none"&gt;
  
  @using (Ajax.BeginForm("SaveUserJson", "User", new { id = Model.Id }, new AjaxOptions
          {
              HttpMethod = "post",
              OnSuccess = "editUserSuccess()",
          }))
      {
  
          &lt;div class="display-field"&gt;
              @Html.DisplayFor(model =&gt; model.Name) 
          &lt;/div&gt;
      .
      .
      .
      Various controls go here...
      .
      .
      .
  
          &lt;p&gt;
              &lt;input type="submit" value="Detach" /&gt;
          &lt;/p&gt;
      }
  
   &lt;/div&gt;
  </code></pre>
  
  <p>Standard stuff so far...</p>
  
  <p>So when the initial list of users is loaded the "Edit users" partial view gets pre-loaded on the page but it's not visible because the div is set to display: none and it's initialized as being a dialog popup.</p>
  
  <p>Next when an "edit" link is clicked next to a specific user I would like that popup to be populated with the information of that selected user.
  Ajax to the rescue!</p>
  
  <p>On "Edit" link click I load the partial view with the selected user data:</p>
  
  <pre><code>function editUserLoad(userId) {
      $.ajax({
          url: '/User/EditUser/',
          data: { id: userId },
          type: 'post',
          datatype:'html',
          success: function (data) {
              $("#edit-user-dialog").html(data);
              $("#edit-user-dialog").dialog('open');
          }
      });
  }
  </code></pre>
  
  <p>Works great! It grabs the selected userId, jumps to my action method that returns the partial view populated with the User data I want to display.</p>
  
  <p>The problem is that the dialog is displayed empty ! Well I know why. It's empty because the dialog DIV is set to "display: none". But why ? Doesn't .dialog('open'); override display: none and doesn't it suppose to show the content of the dialog even if it was hidden ?</p>
  
  <p>I tried to have .show separately but it didnt work.
  Help ?</p>