title: Sys.Application.add_load Problem with Modal popup extender
body: <p>I have the current problem, let's explain the context before :</p>
  
  <p>I have a Modal popup extender who contains a form. There is a feature "Save and Add New", when the user click on this button the data in the form is saved in the database during postback and the page is reloaded. </p>
  
  <p>I want this Modal popup to appear again on the page_load allowing the user to enter new data without clicking again on the button who show this Modal Popup.</p>
  
  <p>I've tried to call it this way first :</p>
  
  <pre><code>ClientScript.RegisterStartupScript(Page.GetType(), "ModalPopup", "ShowModalPopup(""" &amp; Me.formModalButton.ID &amp; """);", True)
  </code></pre>
  
  <p>but the problem was when the function was called my Modal Popup was not existing yet on the page. Because of that the code was crashing on the </p>
  
  <pre><code>var modal = $find('myModal');
  </code></pre>
  
  <p>So, I found that other way and it's working <strong>almost</strong> perfectly.</p>
  
  <pre><code>ClientScript.RegisterStartupScript(Page.GetType(), "ModalPopup", "Sys.Application.add_load(function() {ShowModalPopup(""" &amp; Me.formModalButton.ID &amp; """)};", True)
  </code></pre>
  
  <p>The modal is showing up on the page load like I want, but the problem is if I click on any other button on my page the Modal Popup is also appearing again. </p>
  
  <p>Example : I have another Modal Popup for deleting data, when I click on the button, both Modal are appearing, which is not cool.</p>
  
  <p>Does anyone have a clue about how to fix that or a better way to do it ?</p>
  
  <p>P.S. I'm not calling to Modal popup server-side because the javascript function exist in the page, so I don't want to create a copy of this function in the RegisterStartupScript.</p>
  
  <p>Thx for your time.</p>