Posted By

krisdb on 03/27/07


Tagged

ASP


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

gafsveno
asifrizvigmailcom


delete with checkboxes


 / Published in: ASP
 

  1. <%
  2. if action = "del" then
  3. dim sId: sId = request.form("Id")
  4. dim arrId,iRow,iId,iCount
  5.  
  6. arrId = split(sId,",")
  7. iCount = 0
  8. for iRow = 0 to ubound(arrId )
  9. iId = arrId(iRow)
  10. if len(iId) > 0 then
  11. oConn.execute("delete from table where id = " & iId)
  12. iCount = iCount + 1
  13. end if
  14.  
  15. next
  16. response.write "<div align=""center"" style=""color:blue;""><span style=""font-weight:bold;"">"&iCount&"</span> Id(s) deleted successfully</div>"
  17.  
  18. end if
  19.  
  20. sql="select * from table order by id"
  21. %>
  22.  
  23. <form action=".asp" method="post" name="formName">
  24. <input type="checkbox" name="Id" value="<%=%>">
  25.  
  26. <input type="button" onClick="if (confirm('Are you sure you want to delete?')) {document.formName.submit()}" value="Delete" />
  27. <input type="hidden" name="action" value="del" />
  28.  
  29. </form>

Report this snippet  

You need to login to post a comment.