The Umbraco tree is nice and handy for an webapplication. Building and expanding a custom Umbraco Tree is easy

Create a new Class which inherits from the baseClass, instantiates the base class in the contructor, like this:

public class UwwebburoTree : BaseTree

        public UwwebburoTree(string application) : base(application) {


Override the Render method, check the nodeKey, if empty you're in the root node. If you create a node in root with a nodekey you can check for this key and the new node will be created as a subnode of this key. Nice and easy!

public override void Render(ref XmlTree tree)
            if (this.NodeKey == string.Empty)
                // klanten tree node
                XmlTreeNode xmlTreeNode = XmlTreeNode.Create(this);
                xmlTreeNode.NodeID = "1";
                xmlTreeNode.Text = "Klanten";
                xmlTreeNode.Action = "javascript:OpenKlanenView();";
                xmlTreeNode.Icon = "klant.png";
                xmlTreeNode.OpenIcon = "klant.png";
                xmlTreeNode.NodeType = "klanten";

The last thing is to override the RenderJs method to assign the Javascript action. Since Umbraco is supporting MVC it's possible to let this point to a controller action.

        public override void RenderJS(ref System.Text.StringBuilder javascript)
                                function OpenKlanenView() 
                	                parent.right.document.location.href = '/umbraco/surface/Klanten/Index';

That's all there is to build a custom tree in Umbraco, let's get start to build a Wep-application!




Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!