So, I have a TreeView in my SharePoint masterpage which has quite a lot of treenodes. Some of these link to subsites (also containing the TreeView in their masterpage).
Since it was starting to get quite long, I changed it from this:
<asp:TreeView runat="server" id="TreeView1" ImageSet="Arrows">
To this:
<asp:TreeView runat="server" id="TreeView1" ImageSet="Arrows"
ExpandDepth="0"
SelectedNodeStyle-CssClass="ms-tvselected"
NodeStyle-CssClass="ms-navitem"
NodeStyle-HorizontalPadding="2"
SkipLinkText=""
ExpandImageUrl="/_layouts/images/MDNCollapsed.png"
CollapseImageUrl="/_layouts/images/MDNExpanded.png"
NoExpandImageUrl="/_layouts/images/tvblank.gif">
Now this does give me a collapsed TreeNode, but the thing is I want it to expand when a certain link is clicked.
Let's say this is the content of the TreeView:
Site1
Subsite1_1
Subsite1_2
Subsubsite1_2_1
Site2
Subsite2_1
Subsite2_2
Subsubsite2_2_1
Subsite2_3
Site3
Subsite3_1
Subsubsite3_1_1
If I click on Site1, I want the TreeNode to be expanded to show Site1, and underneath that Subsite1_1 and Subsite1_2. If I then click on Subsite1_2, I want to see Site1, underneath that Subsite1_1 and Subsite1_2, and underneath that Subsubsite1_2_1. I do not want to see any other links expanded, just the ones that are located below the one I clicked.
Is there any way to make this automatically collapse/expand, depending on the page you're located on? With JavaScript perhaps, or another setting?
I'm doing all this in SharePoint Designer 2010, the environment is SharePoint Foundation 2010.
Any help or suggestions are GREATLY appreciated.