Home - Forums-.NET - FlyTreeView (ASP.NET) - Adding Nodes to the root of the tree

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

Adding Nodes to the root of the tree
Link Posted: 11-Apr-2006 04:05
I'm trying to add nodes to the the tree using Client side scripting
Ive got the Context menu appearing when the user right clicks on a node. they get given 4 options

Add Node
Add Child Node
Remove Node
Node Properties

The last 3 work fine
Add Node works on nodes that are more than one level deep in the tree.

The problem starts when the parentNode property of the node passed is null.
this is what I currently have.

function AddNode(node, menuItemKey)
{
  var co = webServiceCallerBody.createCallOptions();
  co.funcName = \"AddNode\";
  co.async = false;
  var oResult;
  if(node.ParentNode == null)
  {
    oResult = webServiceCallerBody.node.callService(co, null , document.all.TaxonomyListDropDownList.value);
    node.TreeView.AddNodes('');
  }
  else
  {
    oResult = webServiceCallerBody.node.callService(co, node.ParentNode.Key , document.all.TaxonomyListDropDownList.value);
    node.ParentNode.AddNodes('');
  }
}

The line in red will throw an error becuase the TreeView doesnt have a AddNode or AddNodes Method.

How can you add to the root of the tree using client side script ?

also how can you start a tree if it has no nodes in it ?
Link Posted: 11-Apr-2006 19:38
Actually the problem is that you cannot add nodes to the root collection.
The TreeView object does not supprt this.
The AddNodes was developed for the Drag-and-drop implementation and was not initially intended for public use.