title: dropdown value is not selected after loading a partial view
body: <p>I have two partial views in the parent view. In the parent view there is a "div" tag that holds a partial view called "state".</p>
  
  <pre><code>&lt;div id="divState"&gt;&lt;/div&gt;&lt;/td&gt;
  </code></pre>
  
  <p>The partial view just has a DDL in it:</p>
  
  <pre><code>@Html.DropDownList("State", null, "---------- Select ----------", htmlAttributes: new { @class = "form-control" })
  </code></pre>
  
  <p>The partial view is loading like below:</p>
  
  <pre><code>$('#divState').load('@Url.Action("LoadState", "General")');
  </code></pre>
  
  <p>Controller code is like below:</p>
  
  <pre><code>[HttpGet]
          public ActionResult LoadState()
          {
              if (Request.IsAjaxRequest())
              {
                  ViewBag.State = new SelectList(db.Generals, "IID", "Value");
                  return PartialView("_State");
              }
              else
              {
                  return null;
              }
          }
  </code></pre>
  
  <p>I have a link button that is opening a modal dialogbox, which is actually a partial view. The partial view holds a couple of fields and a button for saving data. After saving the value will be shown in the state DDL with the last entered value. I have written the following jQuery to store and select the last inserted value.</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
              $(function () {
                  $("#btnSave").click(function () {
                      debugger;
                      $.ajax({
                          type: "POST",
                          url: '@Url.Action("SaveGeneralData", "General")',
                          data: '{name:"' + $("#Value").val() + '", description:"' + $("#Description").val() + '"}',
                          contentType: "application/json; charset=utf-8",
                          dataType: "json",
                          success: function (response) {
                              //alert("Id :" + response.IID);
                              var id = response.IID;
                              $('#divState').load('@Url.Action("LoadState", "General")');// Loading the partial view from controller
  // to get the newly inserted value
                              $('#dialogState').dialog('close');
                              //$('div#divState select').val("5").attr("selected", "selected");
                              $("div#divState select").val("5");
                          },
                          failure: function (response) {
                              alert(response.responseText);
                              //alert("1");
                          },
                          error: function (response) {
                              alert(response.responseText);
                          }
                      });
                  });
              });
      &lt;/script&gt;
  </code></pre>
  
  <p>After inserting value is showing in the DDL as I am reloading the partial view that holds the DDL.
  But my problem is that the last inserted value is not selected. DDL is displaying the first list item after flashing the last insert record (i.e it is hard-coded as "5").</p>
  
  <p>Any help will be thankfully accepted.
  Partha</p>