Table of Contents

Screen Shot




Introduction

This is an extension of the ASP TreeView Control. It has all the functionality of its precedecesor and some new features. The main difference between this control and its predecessor is that it loads data from a data base much faster and it depends mostly on XML transformations to render its output.



New Features and Modifications

This version uses two new stylesheets: This version feature a new class Buffer which is used to concatenate strings rather than using the usuall & - sign.
buffer.append(str1): buf.append(str2) is way faster than str1 & str2.

The LoadFromDb & LoadFolderContents procedures have also been updated. A new public method LoadFromXml has also been added.


Loading the tree nodes from an XML file

If you want to load your treeview from an XML file, make sure your XML file is of the following format:

<items>
    <item>
        <menuid>1</menuid>
        <text>Node 1</text>
        <tooltip>This is node 1</tooltip>
        <target></target>
        <url>http//aspwebsolution.com</url>
        <imageurl></imageurl>
      
<parentid>0</parentid>
    </item>
</
items>

Where the ParentID field is the first ancestor of the tree node. A ParentID of zero indicates a Root Node in the treeview. The URL and ToolTip fields can be left empty for non-leaf nodes. You can then load your treeview by calling the LoadFromXml method as follows:

     TreeView.LoadFromXml(XML File Path)

The sample code below shows how to load the treeview from an XML file - menu.xml

<!--#include file="clsTreeView2.asp"-->
<%

'declare objects
Dim objTV, strFilePath

'set your file path
strFilePath = "menu.xml"
'create instances of your treeview
Set objTV = New TreeView

'load the treeview from the xml file
Call objTV.LoadFromXml(strFilePath)

'display your treeview
objTV.Display

'clear memory
Set objTV = Nothing

%>