title: Load Partial view after page is loaded
body: <p>I have a view that contains a dropdown on load, when the dropdown value is changed it loads a partial view blow the dropdown containing an input form. This works correctly.</p>
  
  <p>Now when i open the page, but the dropdown value has already been selected i need to load that same partial view.</p>
  
  <p>But when i do this the entire layout get's loaded again and not my partial view. 
  Both these post back to the same action. Does anyone have an idea.</p>
  
  <p>Please look at the images below for the outputs.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('#DbDropdown').on('change', function (evt) {
                  LoadBody();
              });
  
              $(window).bind("load", function () {
                  var e = document.getElementById("DbDropdown");
                  var text = e.options[e.selectedIndex].value;
                  if (text != "Please select")
                  { 
                      LoadBody();
                  }                
              });
  
              function LoadBody()
              {
                  var url = "GetHeader";
                  var $Detail = $("#HeaderSection")
                  $.ajax({
                      data: $("#PRForm").serialize(),
                      type: 'GET',
                      cache: false,
                      dataType: 'html',
                      url: url,
                      success: function (result) {
                          $Detail.html(result);
                      },
                      error: function (ex) {
                          alert(ex);
                      }
                  });
              }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  @model PRHeaderVM
  
  &lt;section&gt;
      &lt;h2&gt;Purchase Requesition @Model.PrNumber
       &lt;/h2&gt;
      &lt;form asp-action="SubmitPR" role="form" id="PRForm" style="width: 100%;top:0;right:0;left: 10px; bottom:10px" enctype="multipart/form-data"&gt;
          @Html.HiddenFor(x =&gt; x.PrNumber)
          @Html.HiddenFor(x =&gt; x.Status)
          &lt;div style="margin-top : 10px; position:fixed;top:50px;right:50px;width : 150px"&gt;
              @if (Model.Status == 1)
              {
                  Html.RenderPartial("_CreateButtonTemplate");
              }
              @if (Model.Status == 2)
              {
                  Html.RenderPartial("_ApproveButtonTemplate");
              }
          &lt;/div&gt;
          &lt;div class="form-horizontal"&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-lg-3"&gt;
                      &lt;div class="form-group"&gt;
                          &lt;div style="padding-bottom: 40px;"&gt;
                              &lt;label class="col-lg-4 control-label"&gt;Company&lt;/label&gt;
                              &lt;div class="col-lg-8"&gt;
                                  &lt;select id="DbDropdown" asp-for="CompanyID" asp-items="@Model.Companies" class="form-control"&gt;
                                      &lt;option&gt;Please select&lt;/option&gt;
                                  &lt;/select&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div id="HeaderSection"&gt;
              &lt;/div&gt;            
          &lt;/div&gt;
  &lt;/form&gt;
  &lt;/section&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Selecting the value myself</strong></p>
  
  <p><a href="https://i.stack.imgur.com/oReKm.png" rel="nofollow noreferrer">Selecting the value myself</a></p>
  
  <p><strong>Value loaded from model</strong>
  <a href="https://i.stack.imgur.com/mDfcb.png" rel="nofollow noreferrer">Value loaded from model</a></p>