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>Neighborhoodopenhou
se : : 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>  
;List of Agents to neighborhoodopenhouse.com<
/b></td>
</tr>
<tr>
<td height="14"><b>  
;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,re
gdate 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%"> <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%"> </td>
</tr>
<%
while not rs.eof and Cnt<rs.pagesize
Cnt=Cnt+1
%>
<tr>
<td height="28" width="33%"> <a href="agentdetailsAndListi
ngs.asp?ag
ent=<%=rs(
0)%>"><%=r
s(1)%></a>
</td>
<td height="28" width="25%" align="left"> <%=rs(3)%>, <%=rs(2)%
></td>
<td height="28" width="18%" align=center><%=rs(4)%>
</td>
<td height="28" width="14%" align=center><%=rs(5)%></t
d>
<td height="28" width="10%" align=center>
<div align="center"> <a href="#" onClick="Go_to_Url('<%=rs(
0)%>')">De
lete</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?u
serid="+ 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!