Skip to content Skip to sidebar Skip to footer

Can I Stop A Post Back By Using Javascripts Confirm?

I have an aspx page with a asp.net button on the page:

Solution 1:

You have to return the value from the function in the event handler:

OnClientClick="return ConfirmDelete();"

By the way, you don't need all that logic in the function, just return the result from the confirm call:

function ConfirmDelete() {
  return confirm("Are you SURE you want to delete this item?");
};

Post a Comment for "Can I Stop A Post Back By Using Javascripts Confirm?"