ASP 101 - Active Server Pages 101 - Web05
The Place ASP Developers Go!

Please visit our partners

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates

ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

Script Output:
id text_field integer_field date_time_field Delete?
1200610 Friday 19 11/19/2010 10:14:06 AM
1200611 Friday 19 11/19/2010 10:14:11 AM
1200612 Friday 19 11/19/2010 10:14:11 AM
1200613 d 2 12/12/2010
1200614 Friday 19 11/19/2010 10:29:13 AM
1200615 Friday 19 11/19/2010 10:40:31 AM
1200616 Friday 19 11/19/2010 10:41:04 AM
1200617 Friday 19 11/19/2010 10:42:45 AM

ASP HTML Download            FAQ

ASP.NET Version

What do you get when you combine the fast deleting interface of our image killing script with the database code from our record deleting sample? A script that helps you weed out those unwanted database records in the blink of an eye. This is basically a version of our DB Delete script on steroids. This version lets you delete a bunch of records in one call to the page.

Please note that this is sample code. As such, there is no "Are you sure you want to delete?" step. When you hit delete the records are gone... no recycling bin... no undelete... they are gone. Please take a moment to ponder this fact before you use this code against any data that you care about and please always make a backup!

This sample is running off of our SQL Server, but a copy of the database in Access format is available for download here.

Update: Javascript Delete Confirmation

I've gotten a number of requests for us to add a delete confirmation step to this script. While you could add another post back to the server and do a confirmation step via server-side ASP code, doing it via client-side Javascript provides a more standard pop-up style of confirmation and causes less work for the server. I've added a simple version that just asks "Do you really want to delete the selected records?" to this page. It's nothing fancy, but it should work in most current browsers. I've tested it in IE and Firefox. If you run across a browser in which it doesn't work just let me know and I'll try and get it fixed.

If you don't like the confirmation step, you can eliminate it by simply removing the onsubmit attribute of the form.

For those of you that are looking for a little more sophisticated version, I also whipped up a version that includes the ids of the records to be deleted in the confirmation dialog box. It's a little more complex and probably more likely to break in non-standard browsers, but once again I did test it in IE and Firefox so you shouldn't have any issues with those. If you'd like to take a look at it the advanced version can be found here: db_rec_kill_confirm.asp.


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers