Published in: ASP
call recursiveSelection(0,0) sub recursiveSelection(parent_Id,iInd) dim arrData,strsql strsql = "SELECT [id],[name],[parent_id] FROM [table] WHERE parent_id = " & parent_id arrData = selectDatabase(strsql) if isArray(arrData) then dim iDbId,sDbName,iData for iData = 0 to ubound(arrData,2) iDbId = arrData(0,iData) sDbName = arrData(1,iData) parent_Id = arrData(2,iData) response.write "<div style=""margin-left:"&iInd&"px;""><input type=""checkbox"" name=""id"" value="""&iDbId&""" /> " if (parent_id = 0) then response.write "<span style=""font-weight:bold;"">"&sDbName&"</span> "& vbCrLf else if checkIfInArray(iDbId,[ids],1) = true then response.write "<input type=""checkbox"" name=""id"" value="""&iDbId&""" checked /> " & sDbName & vbCrLf else response.write "<input type=""checkbox"" name=""id"" value="""&iDbId&""" /> " & sDbName & vbCrLf end if end if response.write "</div>" call recursiveSelection(iDbId,iInd+10) next iInd = 10 end if end sub
You need to login to post a comment.
