Export (0) Print
Expand All

add Method

Adds a TreeNode to the end of the TreeView or TreeNode.

Syntax

object.add(node)

Parameters

node Required. The TreeNode to add.

Return Value

No return value.

Example

When applied to the TreeView object, this method adds a root-level TreeNode to the end of the TreeView. When applied to the TreeNode object, this method adds a child-level TreeNode to the end of the parent node's collection. This example shows the differences in this method when applied to the TreeView object and the TreeNode object.


function addNodeToTree(){
    var newNode = oTree.createTreeNode();
    newNode.setAttribute("text", "New Root Node");
    oTree.add(newNode);
    }
function addNodeToNode(){
    var parentNode = oTree.getTreeNode("0");
    var newNode = oTree.createTreeNode();
    newNode.setAttribute("text", "New Child Node");
    parentNode.add(newNode);
    }
		

Code example: http://samples.msdn.microsoft.com/workshop/samples/webcontrols/treeview/add_method.htm

Applies To

TREEVIEW, TREENODE

See Also

Show:
© 2014 Microsoft