Function does not work with UseSubmitBehavior="False"

1

I have this button:

<asp:Button ID="Button11" runat="server" 
  Text="Cancelar" CssClass="btn btn-danger btn-block" 
  OnClick="Button11_Click" 
  OnClientClick="javascript:return confirm('Deseja cancelar toda a venda?');" 
 UseSubmitBehavior="False" />

I need it to be UseSubmitBehavior="False" , but when I put it to false, it does not work confirm , it appears alert , however regardless if I click ok or cancel, it does nothing when the UseSubmitBehavior="true" it works correctly, but if someone clicks the enter, it makes the click of this button , how can I proceed?

    
asked by anonymous 08.01.2018 / 20:51

1 answer

0

Do so

<asp:Button ID="Button11" runat="server" 
  Text="Cancelar" CssClass="btn btn-danger btn-block" 
  OnClick="Button11_Click" 
  OnClientClick="if ( ! UserDeleteConfirmation()) return false;"  />

function UserDeleteConfirmation() {
  return confirm("Deseja cancelar toda a venda?");
}
    
12.01.2018 / 16:42