AVARICESOFT
asked on
i want to find the parent node in treeview using javascript
hello i am create asp.net web application using C#.net
i want to find the parent node of the new node if its exist then add to the another treeview here is the sample code given below
the classes node is statically define in the treeview..
kindly help me how could i find the node parent and then insert in the snode
thanks
i want to find the parent node of the new node if its exist then add to the another treeview here is the sample code given below
the classes node is statically define in the treeview..
kindly help me how could i find the node parent and then insert in the snode
thanks
function ClassNodeEdit(sender, eventArgs) {
var node1 = eventArgs.get_node();
var nodeText = node1.get_text();
var tree = $find("tree_test");
var snode = tree.findNodeByText("Classes");
tree.trackChanges();
var node = new Telerik.Web.UI.RadTreeNode();
node.set_text(node1.get_text());
snode.get_nodes().add(node);
tree.commitChanges();
}
so in your case it would be something like this:
var tree = $find("tree_test");
var snode = tree.findNodeByText("Class es");
var node = new Telerik.Web.UI.RadTreeNode ();
node.set_text(snode.get_pa rent().get _text());
snode.get_nodes().add(node );
tree.commitChanges();
var tree = $find("tree_test");
var snode = tree.findNodeByText("Class
var node = new Telerik.Web.UI.RadTreeNode
node.set_text(snode.get_pa
snode.get_nodes().add(node
tree.commitChanges();
sorry i misused your code, i though the snode is the one ur looking for.
u probably familiar with your code more than i, so if get_parent() doesn't work for you let me know.
u probably familiar with your code more than i, so if get_parent() doesn't work for you let me know.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hey man ur are almost right but kindly give me code of that suppose:
i have 1 RadTreeView1 and 2nd RadTreeView2
i only want to add the node which is added on the RadTreeView1 by hierarchy ..
this function automatically call when RadTreeView1 node created dynamically
function ClassNodeEdit(sender, eventArgs) {
}
i only want to copy the nodes from RadTreeView1 to RadTreeView2 according to hieracry like parents is parent and child is child nothing more.. but in javascript clientside
the ClassNodeEdit function is called when the RadTreeView1 Node is create...
Thanks.
i have 1 RadTreeView1 and 2nd RadTreeView2
i only want to add the node which is added on the RadTreeView1 by hierarchy ..
this function automatically call when RadTreeView1 node created dynamically
function ClassNodeEdit(sender, eventArgs) {
}
i only want to copy the nodes from RadTreeView1 to RadTreeView2 according to hieracry like parents is parent and child is child nothing more.. but in javascript clientside
the ClassNodeEdit function is called when the RadTreeView1 Node is create...
Thanks.
ASKER
thanks i get the solution
for example:
function GetParent()
{
var tree= $find("<%= RadTreeView1.ClientID %>");
var node = tree.findNodeByAttribute("
node.get_parent().expand()
node.select();
}
u can use this link for treeview api:
http://www.telerik.com/help/aspnet-ajax/tree_clientradtreenode.html