title: Modal dialog's onshow not called after postback
body: <p>I have a Bootstrap modal dialog that I am using to populate with data when user clicks on "Edit" in a jQuery data table. There is a Cancel and Submit button on this modal.</p>
  
  <p>When I open the modal and click Cancel and then select another table row and click "Edit", everything is fine; data gets populated correctly each time "Edit" is clicked. However, if I do a postback by clicking "Submit" on the modal and then click "Edit" again, modal opens and no data is there.</p>
  
  <p>I am using modal's on('show.bs.modal', ...) to populate it and it never gets hit after a postback is done.</p>
  
  <pre><code>// This is called when "Edit" in data table row is clicked
  function showEdit(var1, var2) {debugger
      $('#hfVar1').val(var1);
      $('#hfVar2').val(var2);
      showEditModal();
  }
  
  function showEditModal() {debugger
      $("#spnEditHeader").text("Edit Something");
      $('#editModal').modal('show');
  }
  
  $(document).ready(function () {
      // This populates the jQuery data table
      showTable(somthing, anotherThing);
  
      // This is executed as long there is no postback; 
      // once a postback is perfoemd this is not hit, modal not populated
      $('#editModal').modal({
          keyboard: true,
          backdrop: "static",
          show: false
      }).on('show.bs.modal', function (e) {debugger
          var var1= $('#hfVar1').val();
          var var2= $('#hfVar2').val();
  
          //make ajax call to populate items
          populateMPOOEdit(var1, var2);
      });
      ....
  });
  
  //This is the button in modal that causes postback
  &lt;div class="modal-footer"&gt;
      &lt;div id="divEditButtons" style="text-align: center;"&gt;
          &lt;button id="btnCancel" class="btn btn-info2" data-dismiss="modal" aria-hidden="true" aria-label="Cancel"&gt;Cancel&lt;/button&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
          &lt;button id="btnSubmit" class="btn btn-primary" aria-hidden="true" aria-label="Update"&gt;Update&lt;/button&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  // "Submit" button's click handler
  $(document).on("click", "#btnSubmit", function (event) {
      // Validate data (client side validation)
      var isValid = validateUpdate();
  
      // Also need a server side validation checking for duplicate name, using ajax to do this
      $.ajax({
          type: "POST",
          dataType: "json",
          contentType: "application/json; charset=utf-8",
          url: '&lt;%= ResolveUrl("services/mpoo.asmx/NameExists") %&gt;',
          cache: false,
          data: JSON.stringify({ "Name": name }),
      }).done(function (data) {
          var result = data.d;
  
          if (result != '') {
              nameExists = JSON.parse(data.d);
  
              if (nameExists == "true") {
                  $("#lblErrName").text("Duplicate Name");
                  $("#lblEditErrName").show();
                  isValid = false;
              }
              if (isValid) {
                  __doPostBack('btnSubmit', JSON.stringify({
                      action: "SaveUpdate", Var1: var1, ..., Varn: varn
                  }));
                  $('#editModal').modal('hide');
              }
          }
      });
      return false;  // to prevent modal from closing if there are errors on page
  });
  </code></pre>