This is a discussion on "Delete All Row (Select All Row Using Radio Button)" within the Classic ASP section. This forum, and the thread "Delete All Row (Select All Row Using Radio Button) are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Delete All Row (Select All Row Using Radio Button)
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Delete All Row (Select All Row Using Radio Button)
Ok guys...
Let say I have an ASP page that will displays all my data in the database. Each row, I provide a DELETE button so the specific row can be deleted! This method can be very hard if we are consider to delete all the data with ONE CLICK! Can anybody guide me on how to use a RADIO BUTTON to select all the row and at the end of the page, there is a DELETE button that will delete whatever row that I have selected to be deleted This is the display database page...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|
|
||||
|
hard?
put this at the top of your page:
then use this link to delete a record: heres the full code:
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
This is my database connection which will display all data in the recordset!
This code is not working...I mean the delete function is still not working. What I want to do is, when the user select the row using the radio button, and then later click the DELETE ALL button at the end of the page. It will then delete all the selected row <span style="color:red">Can anybody look at my DELETE ALL button?</span id="red">
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|||
|
How to make a DELETE button that will delete all the data inside the RECORDSET that i have specified?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
||||
|
note:
radio button only allows one selection so you have to use CHECKBOX instead, i.e.: <input type=checkbox name=delete then, it's the same thing I posted before: 1. put this at the top of you page:
2. put this at the beginning of each row, so the user can select which records should be deleted
3. use this link deletes one record (put it at the end of each row, within the loop) 4. the submit button will delete all selected records: <input type=submit value="Delete Selected Records">
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
Hai spinal...
When you write this, <input type=checkbox name=delete value="<%=admin("ID")%>">,is it reffering to my recordset for adnmin ID,because my code for that is <%=(admin.Fields.Item("ID").Value)%>. I am a little bit confuse here One more.. For the code below, do I have to change anything there? I dont understand the "SCRIPT_NAME"? One last thing... This is my rs connection, so..you mean I just have to put the code inside it like this??? Can you guide me if i am wrong? i dont understand this part: WHERE (ID=" & record & ")"
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
||||
|
<%=(admin.Fields.Item("ID").Value)%> and <%=admin("ID")%> are the same thing.
then, you must deledt the records before you load the records again so:
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
Thanx spinal..
Let me try it out first. I'll let you know the result.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|||
|
Hai spinal....
I have this problem while executing the delete operation! Can you look at my code PLEASE..... THIS IS THE ERROR THAT I GET Technical Information (for support personnel) Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. /admin/ViewList_RegisteredLecturer.asp, line 8 Line 8 is the: viewLec.Open "DELETE * FROM userlist WHERE (username=" & record & ")" HERE IS MY DATABASE CONNECTION
when i click the delete button (at the end of each row), it will bring to another page where the delete operation will be done. What I want to do now is, when i click the delete button, the selected row to be deleted will dissapear automatically without going to another page. Can you help me with the problem that i am facing here.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
||||
|
What you want to do is very possible.... but I think you should solve your current problem first in order to learn from it. You appear from the above to be deleting records based on a username.... which must surely be a text type database field.... yet you refer to it as if it were a number... user the following:- [b]viewLec.Open "DELETE * FROM userlist WHERE (username='" & record & "')"[b]
However, may I point out that you really should be deleting records based on the unique identifier (Primary Key).... personally I would use the UserID (or whatever you've called it) <blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />What I want to do now is, when i click the delete button, the selected row to be deleted will dissapear automatically without going to another page. Can you help me with the problem that i am facing here.<hr height="1" noshade="noshade" id="quote" /></blockquote id="quote">This is possible. However, you will be placing a critical part of your application's functionality in the hands of javascript.... and this is NEVER a good idea. I thought I would give you the info before you make a decision. Is there anything wrong with spawning a new window using target=_blank for the delete process? This way, the record WILL be deleted regardless of the clients support for javascript. Some things above for you to think about.
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
Hai Rob and spinal...
So that mean, when I change the (refer to database field for the delete purpose) "username" to my "no"-(unique auto number in my database) then the code will work? <span style="color:red">Please help he guys...I have spent more than a week to do this simple task!:sad:</span id="red"> I have a database table called userlist containing Fields: no (autoNumber & primary key also), ID, username (primary Key), password, fullname and email. For now I have refer the "username" fiels instead of the "no" fiels to delete my record... Ok...this code now refer to the autonumber primary key field "no" in my database..Can you look at it and comment if I have a syntax error or wrong coding technique please.....
http://www40.brinkster.com/evanevie/ Hai spinal and Rob..Do I have to change anything in this code? What is the "SCRIPT_NAME" refer to? <font size="1"><A href="<%=Request.ServerVariables("SCRIPT_NAME")%>? delete=<%=(viewLec.Fields.Item("no").Value)%>">Del ete Me!</A></font id="size1">
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
||||
|
1. you missed the ' around the username (assuming it's a string)
For Each record In Request("Delete") viewLec.Open "DELETE * FROM userlist WHERE (username='" & record & "')" viewLec.Close ' close the recordset before you try to open it again Next 2. <%=Request.ServerVariables("SCRIPT_NAME")%> is the name of the script you're currently viewing so that the link will work, whatever the page is called....
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
You mean...all i have to modify here is the "SCRIPT_NAME"??
Are you reffering "SCRIPT_NAME" to be my page name? I dont understand spinal Ok...basically...the code that you gave me will be working on that page without any <form action=""> right? Can you give me some sample So..I have to add the ' around the & record if the identifier is a number? Am I right? If it a string, eg: username, dont use that ' symbol? <blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />For Each record In Request("Delete") viewLec.Open "DELETE * FROM userlist WHERE (username='" & record & "')" viewLec.Close ' close the recordset before you try to open it again Next<hr height="1" noshade="noshade" id="quote" /></blockquote id="quote"> <span style="color <blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />For Each record In Request("Delete")<hr height="1" noshade="noshade" id="quote" /></blockquote id="quote"> Is "Delete" a function or does it refer to any id name?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
||||
|
Request("Delete") fetches all the submitted values for the checkbox names "Delete"
<%=Request.ServerVariables("SCRIPT_NAME")%> RETRIEVES THE CURRENT PAGE ADDRESS, SO WHATEVER YOU CALLED YOUR PAGE, LEAVE THIS ALONE! you have to enclose strings with ', not numbers!!!!!!!!!!!
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
I am sorry spinal...:sad:
I am very blank here. I am very not happy until I successfully complete this function. Could you spent more of your time with me please. Actually I have done my asp page using Macromedia Ultradev4. You can just click without typing any code to it (auto generate codes) Maybe that is the reason why I am having trouble with CODING.... Basically...I am in the process of learning that auto generated code. I have studied lots of code from the internet especially this link that I got from planetsourcecode...Its kind of easy but still when I follow every single step, it still not working! Check Deleting Record Using CheckBox I have posted my file that consist of the Display page, Delete page and also my Database...All of them is working except for the <span style="color:red">Delete using checkbox</span id="red"> and the <span style="color:red">Delete by row</span id="red">. Could you download it and run them in your PC and take a look whats wrong with the code, please... <font size="1">Right click and save target as..</font id="size1"> DOWNLOAD MY CODE HERE I hope that you can take a look at it spinal... I would be grateful if you help me. I know this is a simple problem for you guys....yet I am still in my dark life trying to achieve them.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
||||
|
there!
|