Wrox Programmer Forums
|
BOOK: Professional ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 4 in C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470502204
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 17th, 2013, 11:37 AM
Authorized User
 
Join Date: Oct 2012
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
Question Verify Delete Button

I've created a GridView array with a "Delete" Button. I would like to insert a confirmation message to the user that they are about to delete this record - Continue Yes or No. I thought that there might be a jQuery function such as an extention to the "alert" function that could do this but I have not been able to find such a function. I would want it to process on the client and not have to come back to the server. Do you have any suggestions?
 
Old January 18th, 2013, 06:53 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You can simply use onclick along with confirm:

<input id="delete" type="button" ... onclick="return confirm('Are you sure?');" />

Using jQuery you can hook up the alert like this instead:

$('#delete').click(function() {
return confirm('Are you sure');
});

The nice thing about the latter solution is that's easy to hook up the click handler to multiple buttons at once by changing your selector code.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
nick1248 (January 18th, 2013)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a delete button to each record? zamanbux PHP Databases 0 May 19th, 2012 09:51 AM
Grid view and delete button jack_hilary BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 May 13th, 2010 07:00 AM
php/mysql delete button and delete query dungey PHP Databases 17 April 11th, 2009 12:24 PM
How to delete the added button in outlook haiying Access VBA 0 June 10th, 2005 07:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.