I'm trying to do a simple Delete Confirm using javascript on the click of a WebImageButton & I cannot get it to work. I know the function is fine because if I use a regular .net button it works with no problem. Please let me know if I'm missing something. I keep getting a - Can't eval return ShowConfirm('Are you sure?')"
Button ASPX code:
<
>
Javascript Definition:
script type="text/javascript">function ShowConfirm(MsgTxt) {
if (confirm(MsgTxt))
{
return true; }
else
return false; }
}
</script>
I was able to get it to start displaying the confirm dialog by removing the return in the following code:
<ClientSideEvents Click="return ShowConfirm('Are you sure?')" />
The problem now is that now matter whether the user clicks the OK button or the Cancel button the control posts back to the server. i tried turning of the autopost property but then I dont know how to make it postback when they hit OK.