button click warning

  • Thread starter Thread starter tobinlim
  • Start date Start date
T

tobinlim

I have an ASP.NET page that successfully executes it's Button_Click
event. Now I would like to add a functionality where when the button
is clicked, a message box appears to the user warning them that
previous information is going to be lost. If they select 'OK', then
the Button_Click event proceeds as usual, otherwise they get redirected
to a previous page. I figure this requires some javascript but how??

Thanks in advance!
 
in the codebehind page_load mehod:

string message = "hello world";
string action = "if (confirm('" + message+ "')) return true; else return
false;";
theButton.Attributes.Add("onclick", action);


Yours
andreas.knudsen[at]bekk.no
 
Back
Top