We Recommend

ASP.NET 3.5 Unleashed ASP.NET 3.5 Unleashed
ASP.NET 3.5 Unleashed is the most comprehensive book available on the Microsoft ASP.NET 3.5 Framework, covering all aspects of the ASP.NET 3.5 Framework--no matter how advanced.


Posted By

krisdb on 04/18/07


Tagged

ASP


Versions (?)


recursiveSelection


Published in: ASP 


  1. call recursiveSelection(0,0)
  2.  
  3. sub recursiveSelection(parent_Id,iInd)
  4. dim arrData,strsql
  5.  
  6. strsql = "SELECT [id],[name],[parent_id] FROM [table] WHERE parent_id = " & parent_id
  7. arrData = selectDatabase(strsql)
  8.  
  9. if isArray(arrData) then
  10.  
  11. dim iDbId,sDbName,iData
  12.  
  13. for iData = 0 to ubound(arrData,2)
  14. iDbId = arrData(0,iData)
  15. sDbName = arrData(1,iData)
  16. parent_Id = arrData(2,iData)
  17.  
  18. response.write "<div style=""margin-left:"&iInd&"px;""><input type=""checkbox"" name=""id"" value="""&iDbId&""" /> "
  19.  
  20. if (parent_id = 0) then
  21. response.write "<span style=""font-weight:bold;"">"&sDbName&"</span> "& vbCrLf
  22. else
  23. if checkIfInArray(iDbId,[ids],1) = true then
  24. response.write "<input type=""checkbox"" name=""id"" value="""&iDbId&""" checked /> " & sDbName & vbCrLf
  25. else
  26. response.write "<input type=""checkbox"" name=""id"" value="""&iDbId&""" /> " & sDbName & vbCrLf
  27. end if
  28. end if
  29.  
  30. response.write "</div>"
  31.  
  32. call recursiveSelection(iDbId,iInd+10)
  33.  
  34. next
  35. iInd = 10
  36. end if
  37. end sub

Report this snippet 

You need to login to post a comment.