Confirm message in ASP.NET
You must put this confirmation in your submit button as follows:
btnSubmit.Attributes["onclick"] +=
"return confirm('The system not allow negative inventory,continue?');"
If the user cancels the cancellation, your page will not be returned.
But if you ask that you can determine the user action on the server side, the answer will be negative, not directly. You must add a trick in order to get user action. Perhaps you should set the user action in a hidden field and on the server side get this value and continue.
onClientClick ( aspx)
confirm('your message');
and the onClick tag refer to a function in the code where you can write a function that will be executed only by clicking OK in the message box.
Using the javascript confirmation function, you can allow the user to confirm or click the button. If the user clicks “yes” in the message / warning window, the “Click” button will even be launched on the server. If the no button is not pressed, the event will not be fired. This is especially useful for buttons used for deletion.
button.Attributes("onclick") = "javascript:return " & _
"confirm('Are You Sure you want to do this operation?') "