Developer forum

Forum » Development » TreeView expand

TreeView expand

Nuno Aguiar
Reply
Hi,

We want to build a tree using DW's treeview control, but with some nodes expandable/collapsable (similar to pages) and then capture the event in order to load it's subitems.

Here's the control
<dw:Tree ID="navigationTree" runat="server" OpenAll="False" SubTitle="Module Administration" TranslateTitle="True" TranslateSubTitle="True">

Can anyone help me?

Best Regards,
Nuno


Replies

 
Pavel Volgarev
Reply
This post has been marked as an answer
Hi Nuno,

First of all, you need to set the "LoadOnDemand" property of the Tree control to "True". Next, you need to subscribe to "NodeExpand" event and populate the collection on your child nodes from within your event handler:
protected void navigationTree_NodeExpand(object sender, Dynamicweb.Controls.TreeNodeExpandedEventArgs e)
{
    e.ChildNodes.Add(new Dynamicweb.Controls.TreeNode() { /* Initialize properties */ });
}
Check out the documentation for the Tree control: Dynamicweb Controls - API documentation.

-- Pavel
Votes for this answer: 0
 
Nuno Aguiar
Reply
Hi Pavel,

Thanks

Nuno

 

You must be logged in to post in the forum