We are using the ASP.NET Ajax Treeview control for our navigation in sharepoint. We have bound the Treeview to the PublishingNavigation:PortalSiteMapDataSource SiteMapProvider="CombinedNavSiteMapProvider".
Our problem is that in our navigation a number of links have manually been added to the navigation structure, these links all point to the same page. This means that if you click one of these links you navigate to the actual page BUT on the page loading all nodes that contain any of these extra links are expanded as well as the actual page that we have selected/navigated to.
Here is the control as implemented in our masterpage:
I have set the property SingleExpandPath="True" this works if the client opens a node - all other open nodes close but has no effect on the multiple expanded nodes on page load.
I then created a code behind file for the masterpage and in the Page_Load used the following function RadTreeview1.CollapseAllNodes(); this did not respond at all, thought the clientid was displayed.
void Page_Load(object sender, EventArgs e)
Response.Write("load " + RadTreeview1.ClientID);
I then found the article
Server side events not fired when a Navigation control is bound via SiteMap DataSource
Fire server-side events when the control is bound to SiteMap DataSource.
If a Navigation control is bound to a SiteMapDataSource, the NavigateUrl property of the items will be set.
This effectively disables PostBacks (ItemClick/NodeClick/TabClick events, etc.) because the item navigates
to the particular URL rather than posting back
I then tried to follow this example using the following events
protected void RadTreeview1_OnNodeDataBound(object sender, RadTreeNodeEventArgs e)
"NavigateUrl"] = e.Node.NavigateUrl;
protected void RadTreeview1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
Neither of these events seem to have any effect/do not fire.
We really need to stop this explosion of the treeview, and only have the selected node xepanded on the page load. Can you please help.