Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a tree view which i am populating from active directory i am trying to implement search in tree view , its returning null while its already fill with Active directory data
C#
TreeNode node = TreeView1.FindNode("Txt.Text");   <<<---- TreeView1 = null
                foreach (var childNode in node.ChildNodes)
                {

                }
Posted

1 solution

FindNode[^] accepts valuePath[^] as a parameter with specific PathSeparator[^]. Seems, you pass wrong value.
 
Share this answer
 
Comments
$ultaNn 1-Sep-15 4:25am    
The TreeView1 is empty to find to search . even the treeview is filled ..
$ultaNn 1-Sep-15 4:58am    
The TreeView1 is empty, by this code i have filled treeview from active directory , but i cannot search from tree view..


DirectoryEntry directoryObject = createDirectoryEntry();

//Searcher.Filter = ("(objectClass=organizationalUnit)");
foreach (DirectoryEntry firstChild in directoryObject.Children)
{
if (firstChild.Name.Contains("OU"))
{
TreeNode Node = new TreeNode(firstChild.Name.Remove(0, 3));
TreeView1.Nodes.Add(Node);
}

}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900