Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Delete confirm


Message #1 by mudar@e... on Wed, 27 Nov 2002 09:40:15
Hi, I'm new in town, and I want to confirm record deletion in an aspx 
page. When the user press the delete button, he should get a dialog box 
confirming deletion, if he press "Yes" then the delete code on the server 
will execute, otherwise nothing should happen (no post to server is 
required).
Any hints?!
Message #2 by "yohohuangtao0425" <yohohuangtao0425@s...> on Thu, 28 Nov 2002 13:58:25 -0800
me.registerstartupscript("script","<script>alert('Are you soure delect it?');</script>")
please add it in you delect button_click event.
>Hi, I'm new in town, and I want to confirm record deletion in an aspx 
>page. When the user press the delete button, he should get a dialog box 
>confirming deletion, if he press "Yes" then the delete code on the server 
>will execute, otherwise nothing should happen (no post to server is 
>required).
>Any hints?!



Message #3 by "Andrew Polshaw" <andrewp@w...> on Thu, 28 Nov 2002 10:20:27
This is a JavaScript problem. You could create an ASP component to 
generate this if you are going to use it a lot, but what you need is to 
define a confirm method in the head of the form:

function confirm(form)
{
  var confirmbox = confirm("Are you sure you want to delete this?");
  if(confirm==true)
    form.submit();
}

Then define the button as type button instead of submit, as follows:

<input type="button" value="Delete" onclick="confirm(form);" />

Ask if you need any more help.

> Hi, I'm new in town, and I want to confirm record deletion in an aspx 
p> age. When the user press the delete button, he should get a dialog box 
c> onfirming deletion, if he press "Yes" then the delete code on the 
server 
w> ill execute, otherwise nothing should happen (no post to server is 
r> equired).
A> ny hints?!

  Return to Index