Check which ASP.NET was clicked

You must split the code in 2 different parts: one that executes and after is done pops up a confirmation dialog, and a second part where you submit the form to execute the remaining piece. You can’t do this in one shot because you can’t have server-side code execute, pop up a confirm dialog on the client side and then continue on the server side.

What you have to do is (in pseudo code)

  use scriptmanager to trigger a JavaScript function that displays the confirmation dialog;

The JavaScript function should:

function askConfirm()

  if(confirm('want to continue?'))
     submit_the_form to execute second part of the process();
     return false;

Server-side code again:

//This is the method that should execute after the JavaScript function submits the form
  execute second part of the logic;

Browse More Popular Posts

Leave a Comment