[CLOSED] Returning null node
Code:
private static Node FindNodeById(NodeCollection items, string nodeID)
{
foreach (var item in items)
{
if (item.NodeID == nodeID)
return item as Node;
else
{
var node = FindNodeById((item as Node).Children, nodeID);
if (node != null)
return node;
}
}
return null;
}
public static Node FindNodeById(TreePanelBase tree, string nodeID)
{
return FindNodeById(tree.Root, nodeID);
}
I tried to use the above given function but it is returning null. Where did I make mistake?
Code:
string nodeId = "TEST";
var node = FindNodeById(this.GetCmp<TreePanel>("treePanel"), nodeId);
var parentNodeId = node.ParentNode.NodeID.ToString();
Code Implementation Problem
I can't access my treepanel by using following code snippet.
Code:
this.TreePanel1.Root
I am using MVC.
Isn't there any way by which I can get root node of a particular node with the help of Node Id?