Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 17th, 2013, 11:37 AM
Authorized User
Points: 92, Level: 1
Points: 92, Level: 1 Points: 92, Level: 1 Points: 92, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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?
  #2 (permalink)  
Old January 18th, 2013, 06:53 AM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 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)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:16 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.