Here I want to trace all the TreeNodes of a Treeview Control. Please help me out. I've a req like i need to make Visible false for some sub nodes of the Treeview as per user Rights. Calling A function from Page_Load() ListNodes(Misc_Treeview); <pre lang="cs"> private void ListNodes(TreeView TreeView1) { foreach (TreeNode nodes in TreeView1.Nodes) { //int count = 0; var V = nodes.ChildNodes; foreach (var item in V) { //count++; } } } </pre>
private void PrintRecursive(TreeNode treeNode) { //do something with each node //System.Diagnostics.Debug.WriteLine(treeNode.Text); foreach (TreeNode tn in treeNode.Nodes) { PrintRecursive(tn); } } // Call the procedure using the TreeView. private void CallRecursive(TreeView treeView) { // Print each node recursively. TreeNodeCollection nodes = treeView.Nodes; foreach (TreeNode n in nodes) { PrintRecursive(n); } }
CallRecursive(Misc_Treeview);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)