Como usar o componente AspTreeView 2?
O componente AspTreeView 2 possui diversas funcionalidades agregadas a ele.
Segue abaixo um exemplo de sua implementação:
<html>
<body>
<%
' Exemplo de programa baseado nos exemplos da obout
Dim oTree, ParentID, Cn, Rs
Set oTree = Server.CreateObject("obout_ASPTreeview_2.Tree")
oTree.FolderIcons = "tree2/icons"
oTree.FolderScript = "tree2/script"
oTree.FolderStyle = "tree2/style/Classic"
oTree.AddRootNode "Esta é a pasta Raíz", true
Set Cn = Server.CreateObject("ADODB.Connection")
Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(LCase(Server.MapPath("/")),"web","dados") & "exemplo_tree.mdb"
Cn.Open
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open "SELECT * FROM tree ORDER BY parent, id", Cn, 0, 3
' Populate TreeView in one loop.
Do Until Rs.EOF
If IsNull(Rs("PARENT")) Then
ParentID = "root"
Else
ParentID = "id" & Rs("PARENT") ' ID should start with character.
End If
oTree.Add ParentID, "id" & Rs("ID"), Rs("HTML"), Rs("EXPANDED"), Rs("ICON")
Rs.MoveNext
Loop
Response.Write oTree.HTML()
Set oTree = Nothing
Rs.Close
Set Cn = Nothing
%>
</body>
</html>
|