title: Confirm postback OnClientClick button ASP.NET
body: <pre><code>&lt;asp:Button runat="server" ID="btnUserDelete" Text="Delete" CssClass="GreenLightButton"
                             OnClick="BtnUserDelete_Click"
                             OnClientClick="return UserDeleteConfirmation();" 
   meta:resourcekey="BtnUserDeleteResource1" /&gt;
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>function UserDeleteConfirmation() {
          if (confirm("Are you sure you want to delete this user?"))
              return true;
          else
              return false;
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>function UserDeleteConfirmation() {
      if (confirm("Are you sure you want to delete this user?")) {
              __doPostBack(btnUserDelete, '');
      }
  
      return false;
   }
  </code></pre>
  
  <p>And none of them works.</p>