Subscribe

RSS Feed (xml)

How to use Treeview IE Web Control

The first step is to install the IE Web Controls from Microsoft.The link to download and
install these controls is as follows: http://msdn.microsoft.com/downloads/samples/
internet/default.asp?url=/downloads/samples/internet/asp_dot_net_servercontrols/webcontrols/default.asp


The next step is to add a reference to the controls on your page:
<%@ Register TagPrefix=”mytree” Namespace=”Microsoft.Web.UI.WebControls”
Assembly=”Microsoft.Web.UI.WebControls” %>;
<%@ import namespace=”Microsoft.Web.UI.WebControls” %>;
Then you add the TreeView control to your page:


The last step is to add the node information to the TreeView.This is the list of items that
will appear when you expand the tree:
<mytree:treeview runat=”server” id=”myTree”>
<mytree:treenode text=”Cars”>
<mytree:treenode text=”Ford” />
<mytree:treenode text=”Toyota” />
<mytree:treenode text=”Infiniti” />
</mytree:treenode>
</mytree:treeview>

Here, we created one node called Cars and then added nodes within that node for different
car manufacturers.

The TreeView IE Web Control is a very powerful and easy-to-use control. In this example,
you saw how easy it was to create an explorer-like expandable tree.When adding
nodes to the TreeView, you use a very XML-like approach whereby the nodes that are
under a parent node are contained inside the parent node tag. If you encounter errors
when trying to add a reference to your page, or you receive errors indicating that the
Web Controls cannot be found, copy the Web Controls DLL to the bin directory of
your application.