Client Side Confirmation For Delete
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngclient' list.


CBurnet2@fnmortgage.com
-- Moved from [aspngfreeforall] to [aspngclient] by Marcie Jones <Click here to reveal e-mail address> --

I am trying to create a form with two buttons: Save and Delete. When the
user clicks Save the normal server side event handler would work and the
item would get saved. However when the user clicks Delete I would like to
have a JavaScript confirm dialog come up and ask them if they really want to
delete. If they click Cancel in the JavaScript confirm dialog then nothing
would happen. If they click OK in the JavaScript confirm dialog then the
page would continue with the normal server side event handler for the Delete
button. Is this possible? I have read a few articles at different ASP.NET
sites that all deal with making it work inside the DataGrid. I am not using
the DataGrid, just a normal ASP.NET page. Also those articles refer to
using the Page.RegisterOnSubmitStatement method to add in an OnSubmit event
handler to the form tag. However, unless I am missing something, this will
not really help me because that event handler will fire ALL of the time that
the form is submitted regardless of whether I have clicked the Save button
or the Delete button.

I have included a simple ASP.NET page that illustrates what I am trying to
do:

<script runat="server">

Sub SaveButton_Click(sender As Object, e As EventArgs)
'Save code goes here...
End Sub

Sub DeleteButton_Click(sender As Object, e As EventArgs)
'Delete code goes here...
End Sub

</script>
<html>
<form runat="server">
<asp:TextBox id="myName" runat="server" />
<asp:Button id="SaveButton" onclick="SaveButton_Click" runat="server" />
<asp:Button id="DeleteButton" onclick="DeleteButton_Click"
runat="server" />
</form>
</html>

Corey Burnett
Development Team Lead
First Nationwide Mortgage
301-696-4703
Click here to reveal e-mail address

Reply to this message...
 
    
Andy Smith
use my ConfirmedButtons components.
http://www.aspalliance.com/asmith/articles/ConfirmedButtons.aspx

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

Reply to this message...
 
    
Tim Cools
With mybutton.attributes.add()
Add the onclick attribute to the button and the confirm() from
javascript
This will do the trick

Tim=20

-----Original Message-----
From: Andy Smith [mailto:Click here to reveal e-mail address]=20
Sent: donderdag 11 juli 2002 18:58
To: aspngclient
Subject: [aspngclient] RE: Client Side Confirmation For Delete

use my ConfirmedButtons components.
http://www.aspalliance.com/asmith/articles/ConfirmedButtons.aspx

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

Reply to this message...
 
    
Andy Smith

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

Reply to this message...
 
 
System.EventArgs
System.Web.UI.MobileControls.TextBox
System.Web.UI.Page
System.Web.UI.WebControls.DataGrid
System.Web.UI.WebControls.TextBox
System.Windows.Forms.DataGrid
System.Windows.Forms.TextBox




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com