Hello,
I'm using the Microsoft Web Control. I'm dynamically loading the control with data from the database where there are parent nodes and children nodes that could be up to 5 levels. I have a Javascript function that executes when a parent node is checked to automatically select all the children below it. Now I have to figure out a way to find out what nodes are selected so that I can process them properly. The only way I see this happening is if I create a hidden variable and loop through all the nodes in the TreeView and add the nodes to the variable if they are checked. However, I'm having a problem looping though the nodes. The only information I found was the SelectNodeIndex property which just gives me the node that was selected.
This is my TreeView Format:
-
Folder10
-
Folder 11
-
Folder 12
-
Folder 13
I need to find out which Item was selected in the TreeView. So lets say that I checked the Folder10 and Folder12 (all the subfolders and items are selected automatically). Then I want the hidden variable to hold all the selected nodes in this format;
Variable = Folder10_1_item1 (So the each parent node selected would start of with text "Folder" then the ID of the folder, then an "_" which means there is a child. Then the ID of the subFolder and then the text "item" and then the ID)
So If I selected Folder10 and Folder12 in the TreeView, I would like the variable to hold this information
Variable = Folder10_1_item1;Folder10_2_item2;Folder12_4_5_6_Item6
Can someone please help? How can I loop through each node of the treeview to achieve this.
Thank you