I have the following command to delete button.
DeleteButton.Attributes.Add("Onclick", "javascript:return confirm(Are you sure?" + ");");
I want to know what the user has clicked(Ok/Cancel) on the server 开发者_运维百科side to continue with delete.
How can this be achieved? code snippet or example would be great.
since you're relying on javascript for the confirmation, you can stop the delete action before it gets submitted to the server.
DeleteButton.Attributes.Add("Onclick",
"if ( ! confirm('Are you sure?') ) { return false; }" );
keep in mind that if the user has javascript disabled, all of this is going to doing absolutely nothing. you should have a backup method of verification that operates server-side.
精彩评论