Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting checked records off of a page

Status
Not open for further replies.
Apr 6, 2001
41
US
Check out the following URL and you'll get an idea of what I want (take notice of the left-most column with the "Delete" button and checkboxes)...


QUESTION: How would my users delete records off a page at their will? Kind of like a "delete checked" option for the user. Granted, I don't want these records to be deleted off the database itself...only off of the page that that particular user sees. I've seen this type of thing around the 'net (done with ASP & Javascript, I think) so I know it can be done...but I haven't been able to get it to work. And I really need it.

Here's how the page works: The companies are being called onto the page according to their industry ID (meaning each industry has an ID number). Have a look at to get a feel of what this whole thing is (you can leave the user info forms blank but be sure to check a few industries).

Just FYI: If an individual company ID is needed to delete checked records off the page, there is an Auto-Numbered field in my database called "ID" where each individual company has its own ID number...if needed.

Anyone know how to do it? Wish I did.

Thanks!
 
Hi,

QUESTION: How would my users delete records off a page at their will? Kind of like a "delete checked" option for the user. Granted, I don't want these records to be deleted off the database itself...only off of the page that that particular user sees. I've seen this type of thing around the 'net (done with ASP & Javascript, I think) so I know it can be done...but I haven't been able to get it to work. And I really need it.

I can think of a few ways to do this off the top of my head. I won't post any code because I don't have the time to do a 'test.asp' etc :)

Method 1) Give the checkbox a value of the record id. When the user clicks 'Delete' you Request.Form the value of the checkboxes and Split them into an array. Now within your recordset (Do Until objRs.bof And objRs.eof or whatever you are using) you check to see if the current record matches any of the IDs in the checkbox array - if it does then don't output it and 'movenext'. Essentially a simple loop within a loop albeit a bit wasteful as you are still returning every record.

Method 2) Same principle but this would involve a dynamic SQL query ie add a 'WHERE ID <> checkboxArray'. This method would probably be better than the first as you would only have the records returned that your user wanted to see.

Method 3) Write some javascript via ASP which would hold the recordset in an javascript array and show/hide the array references. This way you could hide the records instantly by clicking on the checkboxes. Possibly use this in conjunction with Method 2 - you get the idea.

Hope some, if not all of that helped in some way :)
 
Thanks Justin! I like your ideas 2 and 3.

But I need more help with this. I'm still a newbie and I don't know exactly what I'm doing.

Please can anyone else help walk me through this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top