Hi,
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:
<telerik:RadTreeView ID="RadTreeView1"
runat="server"
DataSourceID="ourdatasourcename"
Flow="Vertical"
EnableEmbeddedSkins="false"
SkinsPath="~\Telerik\Skins"
Skin="ourskinname"
ClickToOpen="true"
SingleExpandPath="True"
MultipleSelect="False"
AutoPostBack="true"
ExpandMode="ClientSide"
ExpandDirection="Down"
OnClientLoad="On_Load">
</telerik:RadTreeView>
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 have tried to utilize javascript and close all expanded nodes and then only expand the selected node via the OnClientLoad, but this client side event does not fire (I could do this on a button click event and it works, I also called this function via the body onLoad which did not work - nothing happened).
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.
I then found the article
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
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.
Vanessa
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:
<telerik:RadTreeView ID="RadTreeView1"
runat="server"
DataSourceID="ourdatasourcename"
Flow="Vertical"
EnableEmbeddedSkins="false"
SkinsPath="~\Telerik\Skins"
Skin="ourskinname"
ClickToOpen="true"
SingleExpandPath="True"
MultipleSelect="False"
AutoPostBack="true"
ExpandMode="ClientSide"
ExpandDirection="Down"
OnClientLoad="On_Load">
</telerik:RadTreeView>
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 have tried to utilize javascript and close all expanded nodes and then only expand the selected node via the OnClientLoad, but this client side event does not fire (I could do this on a button click event and it works, I also called this function via the body onLoad which did not work - nothing happened).
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.
protected
void Page_Load(object sender, EventArgs e)
{
RadTreeview1.CollapseAllNodes();
Response.Write("load " + RadTreeview1.ClientID);
}
I then found the article
Server side events not fired when a Navigation control is bound via SiteMap DataSource
http://www.telerik.com/support/kb/aspnet-ajax/menu/server-side-events-not-fired-when-a-navigation-control-is-bound-via-sitemap-datasource.aspxFire 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)
{
e.Node.Attributes[
"NavigateUrl"] = e.Node.NavigateUrl;
e.Node.NavigateUrl =
"";
}
protected void RadTreeview1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
{
Response.Redirect(e.Node.Attributes["NavigateUrl"].ToString());
}
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.
Vanessa