I have been trying for about 3 hours now to figure out how to dynamically expand and collapse treeView nodes.
The treeView is databinded to a siteMap which looks like this:
<siteMapNode url ="default.aspx" title ="Home" description ="Home" id="Home">
<siteMapNode url="calendar/view.aspx" title="Calendar" description="View Calendar" id="Calendar">
<siteMapNode url="events/list.aspx" title="Events" description="List Events" id="Events">
<siteMapNode url ="events/manage.aspx" title ="Manage" description ="Manage Events" id="ManageEvents"/>
</siteMapNode>
<siteMapNode url ="reminders/list.aspx" title ="Reminders" description ="List Reminders" id="Reminders">
<siteMapNode url ="reminders/manage.aspx" title ="Manage" description ="Manage Reminders" id="ManageReminders"/>
</siteMapNode>
</siteMapNode>
<siteMapNode url="contacts/list.aspx" title="Contacts" description="List Contacts" id="Contacts">
<siteMapNode url ="contacts/add.aspx" title ="Add" description ="Add Contact" id="AddContacts"/>
<siteMapNode url ="contacts/print.aspx" title ="Print" description ="Print Contacts" id="PrintContacts"/>
<siteMapNode url ="contacts/import.aspx" title ="Import" description ="Import Contacts" id="ImportContacts"/>
<siteMapNode url ="contacts/export.aspx" title ="Export" description ="Export Contacts" id="ExportContacts"/>
</siteMapNode>
<siteMapNode url="links/list.aspx" title ="Links" description ="List Links" id="Links">
<siteMapNode url ="links/manage.aspx" title ="Manage" description ="Manage Links" id="ManageLinks"/>
</siteMapNode>
<siteMapNode url ="files/list.aspx" title ="Files" description ="List Files" id="Files">
<siteMapNode url ="files/manage.aspx" title ="Manage" description ="Manage Files" id="ManageFiles"/>
</siteMapNode>
</siteMapNode>
The treeView id="secNavMenu"
Basically I have 2 issues. The second issue isn't too bad as I can live with it it. However if I can't figure out the first issue I'm gonna have to manually create <nodes><asp:treeviewnode>.... on each page.
Issue#1 - using the sitemap above I'd like to dynamically collapse all nodes but the selected node. ie. if I'm on the calendar page I'd like all other nodes to be collapsed. I'd like to do this via the .aspx.vb pages for each page that I have. Otherwise I'll have to manually create the treeViews for each page!
Issue#2 - I can't seem to get it so that "Home" isn't the only Root node. The only way I could work it out so there are no was with all other nodes being children of Home.
Obviously I'm very new to asp.net and I would greatly appreciate any help!
Thanks,
Michael
If everything happens for a reason what is the reason for this error?