title: Close Popup Window after insert
body: <p>I have a popup window that closes when click ( Cancel ) button, code below :</p>
  
  <pre><code>btnCancel.Attributes.Add("onclick", "window.close();");
  </code></pre>
  
  <p>but I want to use another button ( Save ) to insert to Database then close the window :</p>
  
  <pre><code>if( success )
  {
  closePopup();
  }
  </code></pre>
  
  <p>I tried to google this issue but most solutions didn't fix it for me.</p>
  
  <p>Thanks in advanced,</p>
  
  <ul>
  <li>Update : insert function will be C# code, not javaScript .</li>
  </ul>