[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

Delete Multiple Rows with Check Box

Asked by jaysch in Active Server Pages (ASP)

Tags: neighborhoodopenhouse, delete

Hi,

I would like to be able to mark which rows in a table to delete via a check box. Then, by pushing a button, the page will be updated and the rows marked will be deleted from the database.

Currently, I am able to delete only one row at a time by clicking the "Delete" link and then clicking OK in a js confirm button. I would like to replace this single delete functionality with the ability to delete multiple rows at a time using check boxes.

This is the asp page the displays the records (in pages of 20 records) and a "Delete" link for each row:



<html>
<head>
<title>Neighborhoodopenhouse : : Administrator Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td><!--#include file="header.asp"--></td>
  </tr>
  <tr>
    <td bgcolor=ffffff height="390" valign="top">
      <table width="780" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="145" height="390" bgcolor="eeeeee" valign="top">
            <!--#include file="side_admin.asp"-->
          </td>
          <td width="635" height="390" valign="top">  
            <table width="100%" border="0" cellspacing="2" cellpadding="2">
              <tr>
                <td height="14"><b>&nbsp;&nbsp;List of Agents to neighborhoodopenhouse.com</b></td>
              </tr>
              <tr>
                <td height="14"><b>&nbsp;&nbsp;Click on the email to view the
                  complete details of the Agent</b></td>
              </tr>
              <tr>
                <td valign="top">
                  <%
                                          purl="manageagents.asp?c=1"
                                          set rs = Server.CreateObject("ADODB.RECORDSET")
                            Sql="Select userid,emailid,fname,lname,agency,regdate from member order by lname"
                                          rs.open Sql,Conn,3,3                                          
                            rs.pagesize= 20
                                          if not rs.eof then      
                                          Cnt=0                                    
                                          %>
                  <table width="100%" align="center">
                    <tr>
                      <td height="21"> <%=Pagination(rs,purl)%> </td>
                    </tr>
                  </table>
                  <table width="100%" border="0" cellspacing="1" cellpadding="1" align="center" bgcolor="#669966">
                    <tr>
                      <td bgcolor="#FFFFFF" valign="top">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr bgcolor="#99CC99">
                            <td height="19" width="33%">&nbsp;<b>Email</b></td>
                            <td height="19" width="25%">
                              <div align="left"><b>Name</b></div>
                            </td>
                            <td height="19" width="18%">
                              <div align="center"><b>Agency</b></div>
                            </td>
                            <td height="19" width="14%">
                              <div align="center"><b>Reg Date</b></div>
                            </td>
                            <td height="19" width="10%">&nbsp;</td>
                          </tr>
                          <%
                                          while not rs.eof and Cnt<rs.pagesize      
                                          Cnt=Cnt+1
                                      %>
                          <tr>
                            <td height="28" width="33%">&nbsp;<a href="agentdetailsAndListings.asp?agent=<%=rs(0)%>"><%=rs(1)%></a></td>
                            <td height="28" width="25%" align="left"> <%=rs(3)%>,&nbsp;<%=rs(2)%></td>
                            <td height="28" width="18%" align=center><%=rs(4)%>
                            </td>
                            <td height="28" width="14%" align=center><%=rs(5)%></td>
                            <td height="28" width="10%" align=center>
                              <div align="center"> <a href="#" onClick="Go_to_Url('<%=rs(0)%>')">Delete</a></div>
                            </td>
                          </tr>
                          <tr>
                            <td height="1" colspan="5" bgcolor=green></td>
                          </tr>
                          <%
                                                      rs.movenext
                                          wend
                                          end if
                                                      
                                                      %>
                        </table>
                      </td>
                    </tr>
                  </table>
                  <table width="100%" align="center">
                    <tr>
                      <td height="21"> <%=Pagination(rs,purl)%>
                        <%
                                                            rs.close
                                                            Set rs=nothing
                                                            
                                                            %>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr>
                <td valign="top"> </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td><!--#include file="footer.asp"--></td>
  </tr>
</table>
<Script language="JavaScript">
  function Go_to_Url(val)
  {
   var userid=val;
   
    var flag=confirm("Are you sure to delete this listing");
      if (flag==true)
      {
         theurl="deleteagents.asp?userid="+ userid;
       location.replace (theurl);
      }
      else
      {
      
      }  
  }

</Script>
 </body>
</html>






The page above (manageagents.asp) posts to the page that contains the delete query (deleteagents.asp):


<%
 userid=request("userid")

 Sql="Delete from member where userid="& userid
 Conn.Execute Sql

 
 response.Redirect "manageagents.asp"            

%>      





Please provide the required code changes to accomplish the task of replace the "Delete" link with a check box that will allow for multiple deletes.

Thank you!









[+][-]10/06/06 07:17 AM, ID: 17676530Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/06/06 12:10 PM, ID: 17679246Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/11/06 06:43 AM, ID: 17706774Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/11/06 07:07 AM, ID: 17706956Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/11/06 07:28 AM, ID: 17707159Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/11/06 05:30 PM, ID: 17711917Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/11/06 07:15 PM, ID: 17712414Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Active Server Pages (ASP)
Tags: neighborhoodopenhouse, delete
Sign Up Now!
Solution Provided By: amit_g
Participating Experts: 2
Solution Grade: A
 
[+][-]10/11/06 08:06 PM, ID: 17712579Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81