ASP.NET - Code Samples - Confirm Message
ASP.NET Confirm that a user wants a button event to occur
Synopsis:
Using a javascript confirm function it is possible to allow a user to confirm or canel a button click. If the user presses yes on the message/alert box the button click even will be triggered on the server. If the no button is click no event will be triggered. This is especially useful with buttons used for deleting.
The Code:
Add a confirm message for a button named 'DeleteButton'
In Form_Load
DeleteButton.Attributes("onclick") = "javascript:return " & _ "confirm('Are You Sure you want to delete?') "