Hi
I need to search in a webdatatree if a node is present or not using the Key.
example
Mytree.Nodes.FindNodeByKey(sKey)
I pass the id to the FindNodeByKey which contains the Key.
But the above code only searches in the first level where as I need to search in the child level also if present.
Presently I have written for loop for it
For Each oItem As DataTreeNode In MyTree.Nodes
oNode =oItem.Nodes.FindNodeByKey(sId)
If oNode IsNot Nothing Then Exit For
Next
This code is ok as I know I have only on child level. but in future it may increase.
Is there any method which gives me all the nodes present in the Tree from the root to the last child node.
Please let me know if its there.
Thanks
Vijay
Hello Vijay,
Thank you for contacting Infragistics!
I have done some looking into this matter and have the following information. What you can do is use the array AllNodes off the WebDataTree to search for the node you are looking for.
http://help.infragistics.com/doc/ASPNET/2014.2/CLR4.0/?page=Infragistics4.Web.v14.2~Infragistics.Web.UI.NavigationControls.WebDataTree~AllNodes.html
The AllNodes is an array that contains all the nodes in the WebDataTree as a flat array. You can get this then search the node yourself manually instead of going through the nodes of the parent then the nodes of the child for each parent in the tree.
string nodeKey = ((Infragistics.Web.UI.NavigationControls.NavItem)(WebDataTree1.AllNodes[2])).Key;
Please let me know if you have any further questions concerning this matter.
In my case, I'm trying to find a child node by key and trying to add a child node for that. Can I know how that is done?
Protected WithEvents Mytree As Global.Infragistics.Web.UI.NavigationControls.WebDataTree
for everyitem in a Datatable//traversing rows in a table
If CInt(TreeRow.Item("TreeLevel")) = 1 Then
Dim MyNode As Infragistics.Web.UI.NavigationControls.DataTreeNode
///setting some data
myNode.Key = Some value & "||" & somevalue
Me.mytree.Nodes.Add(Node)
Dim myInfoNode As Infragistics.Web.UI.NavigationControls.DataTreeNode
myNode.Nodes.Add(myInfoNode)
else
Dim MyNode As Infragistics.Web.UI.NavigationControls.DataTreeNode = Me.mytree.Nodes.FindNodeByKey("Added value")///this is able to find only the Me.mytree.Nodes(0)
dim MySubNode As Infragistics.Web.UI.NavigationControls.DataTreeNode
MySubNode.Key = Some value & "||" & somevalue
MyNode.Nodes.Add(MySubNode )
next
Is there anyway of setting a property(in the current version of webdatatree) for nodes that can be accessed like the TAG property in version 7 for ultrawebtree ?
Any help could be appreciated.
Thanks,
Sunil.