[Solved] 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)

button1_Click()
{
  Execute_logic;
  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();
  else 
     return false;
}

Server-side code again:

//This is the method that should execute after the JavaScript function submits the form
Handler_ForSecondPartOfTheRequest()
{
  execute second part of the logic;
}

solved Check which ASP.NET was clicked