title: Disappearing fancybox calling javascript client side function from asp.net
body: <p>I'm trying to call one client side function from the code behind in asp.net using below code: </p>
  
  <pre><code>        protected void Button2_Click(object sender, EventArgs e)
      {
          ClientScript.RegisterClientScriptBlock(this.GetType(), "Script", "&lt;script&gt; showFancy('ClaimNewForm.aspx?ordernumber2=' + $('#TxtContractNumber').val(), 'Send to Claim', '55%', '65%');&lt;/script&gt;", false);
      }
  </code></pre>
  
  <p>for that, I have added onclick attribute to page render of the page :</p>
  
  <pre><code>        protected void Page_PreRender(object sender, EventArgs e)
      {
          Button2.Attributes.Add("onclick", "showFancy('ClaimNewForm.aspx?ordernumber2=' + $('#TxtContractNumber').val(), 'Send to Claim', '55%', '65%'); return true;");
  
      }
  </code></pre>
  
  <p>and below is showfancy function that I'm trying to call:</p>
  
  <pre><code>    function showFancy(url, title, width, height) {
  
          $(".fancyBox").fancybox({
              'width': width,
              'height': height,
              'autoScale': true,
              'transitionIn': 'elastic',
              'transitionOut': 'none',
              'type': 'iframe',
              'overlayColor': '#000000',
              'overlayOpacity': 0.7,
              'position': 'fixed',
              'scrolling': 'yes',
              'modal': false,
              'target': "_parent",
  
              "onClosed": function () {
                  window.location = window.location;
              }
  
          });
          $('.fancyBox').attr({ href: url, title: title });
          $('.fancyBox').click();
      }
  </code></pre>
  
  <p>the function works fine when I call it from client side but when I'm using above method, the show fancybox page appears but disappears after some moments. </p>
  
  <p>For some reasons and pre-checking, I need to call this function from server side. any help is appreciated and let me know if more details are required.</p>