title: After button postback (Server side) jquery dialog moves to top of page
body: <p>I've got a jquery dialog that opens up.  On it are some server side drop down lists that have <code>AutoPostback</code> set to <code>true</code> because they cascade and fill other drop down lists after a postback.  I maintain keeping my dialog open after a server side post back by making use of a hidden field and setting it to 1 if I need to keep the dialog open or 0 if I want to close it. </p>
  
  <p>Heres the jquery test to see hidden field value:</p>
  
  <pre><code> if ($("#MainContent_hdnOpenContactCompany").val() === "1") {
                  $("#dialogContactCompany").dialog("open");
              } else {
                  $("#dialogContactCompany").hide();
              }
  </code></pre>
  
  <p>So my issue is not that I do not have the dialog open, my issue is when Im scrolled down a page and I open a dialog, the minute I do a postback the dialog moves to to the top of the page.  So the user cannot see it unless he / she scrolls to the top.</p>
  
  <p>I tried adding this, (<a href="http://www.cleancode.co.nz/blog/240/jquery-dialog-position-problem-web-form-postback" rel="nofollow">http://www.cleancode.co.nz/blog/240/jquery-dialog-position-problem-web-form-postback</a>), but I believe the author has a set width...but this did not work for me.</p>
  
  <pre><code> //Company dialog
              var pos = new Array();
              pos[0] = ($(window).width() - 880) / 2 +
                         parseInt(theForm.elements['__SCROLLPOSITIONX'].value);
              pos[1] = 100 + parseInt(theForm.elements['__SCROLLPOSITIONY'].value);
  
              $("#dialogContactCompany").hide();
              $("#dialogContactCompany").dialog({
                  autoOpen: false,
                  appendTo: "form:first",
                  position: pos,
                  width: 880,
                  height: 'auto',
                  modal: true,
                  open: function (event, ui) {
                      $('#dialogContactCompany').css('overflow', 'hidden'); //this line does the actual hiding
                  },
                  close: function (event, ui) {
                      //if someone x's out (Closes the dialog) we better make sure we
                      //set the hidden field to 0 so that the dialog doesn't open up again on post back
                      $("#MainContent_hdnOpenContactCompany").val("0");
                  }
  
              });
  </code></pre>
  
  <p>Mainly the <code>pos</code> information to maintain a position but that too does not work.  How can I fix this?</p>