Home - Forums-.NET - FlyTreeView (ASP.NET) - adding nodes from client side javascript

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

adding nodes from client side javascript
Link Posted: 24-Aug-2005 11:50
Hi,
Thank you for answering my question about the context menu. It works well.

If have another question:
I have to add&delete items from the treeview from a client side javascript. I did not found any examples/...

-how do I referenz the tree object&selected node.
-how do I add new nodes & delete existing ones.

regards
urs
Link Posted: 24-Aug-2005 23:36
There's a client runtime folder of flytreeview containing flytreeview.htc and node.htc HTML component files, having header with client-side methods and methods declaration.

As you can refer to this file:
Selected node is in FlyTreeView.SelectedNode property.
To delete node - Node.Remove() method.
To add node - Node.AddNode(node) or Node.AddNodes(validNodesXML).
Link Posted: 18-Jan-2006 12:03
I'm working on clientside node creation, here's my code:

var oXml = new ActiveXObject("Microsoft.XMLDOM");
oXml.async = false;
var xmlNodeElement = oXml.createElement("NODE");
xmlNodeElement.setAttribute("Key","1111");
xmlNodeElement.setAttribute("Text","New Collection");
xmlNodeElement.setAttribute("ToolTip","New Collection");
xmlNodeElement.setAttribute("ImageUrl","file_asp.gif");
var oParentNode = FTV.SelectedNode.ParentNode;
oParentNode.AddNode(xmlNodeElement);

The last call - oParentNode.AddNode(xmlNodeElement) triggers a call to the following node.htc function:

function o119(o126){
o118('' + o126.XmlElement.xml + '');
}

In order to get my code above to work, I'm having to remove the XmlElement reference in this function as follows:

function o119(o126){
o118('' + o126.xml + '');
}

When I modify this function - the script works, otherwise o126.XmlElement.xml returns a null reference exception.  I don't want to have to update the code in the node.htc component.  Any suggestions?

By the way - this is a very nice component.