Client Side Confirm



I want to use a confirm ("Are you sure?") for deletes but can't seem to get
it to work without using built in commands (delete, insert, etc) If I use a
button click event the process continues to execute just as if I hit OK when
the cancel button is clicked.
Why does this happen and how do I implement a confirmation for events?

<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
onclientclick="confirm('Are you sure?')" Text="Button" />

protected void Button1_Click(object sender, EventArgs e)


Button1.Text = "OK";


No matter which confirm button I click it executes the Button1_Click


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question