custom navigation template
Hi all,
I wrote custom navigation template. In code behind, 'SiteMapNavigationTreeView' control was binded. If a page ShowInNavigation flag's 'false', don't want to show in navigation. If sitemap depth bigger than 2, It cause problem. How to unvisible?
Here is my .cs code :
protected void Page_Load(object sender, EventArgs e)
SiteMapNode smn = SiteMapBase.GetCurrentProvider().CurrentNode;
while (smn.ParentNode != null)
if (smn.ParentNode.ParentNode == SiteMap.RootNode)
siteMapControl_verticaltree.DataSource = getNodes(smn);
siteMapControl_verticaltree.DataBind();
break;
smn = smn.ParentNode;
protected SiteMapNodeCollection getNodes(SiteMapNode smn)
SiteMapNodeCollection col = new SiteMapNodeCollection();
for (int i = 0; i < smn.ParentNode.ChildNodes.Count; i++)
if (((Telerik.Sitefinity.Web.PageSiteNode)(smn.ParentNode.ChildNodes[i])).ShowInNavigation)
col.Add(smn.ParentNode.ChildNodes[i]);
return col;
---------------------------------------------------------------------------------
asp.x
<sf:ConditionalTemplate ID="ConditionalTemplate8" Left="NavigationMode" Operator="Equal"
Right="VerticalTree" runat="server">
<navcontrols:SiteMapNavigationTreeView runat="server" ID="siteMapControl_verticaltree"
Skin="Sitefinity">
</navcontrols:SiteMapNavigationTreeView>
</sf:ConditionalTemplate>
-----------------------
Hello Özkan,
My recommendation would be to use SitefinitySiteMapDataSource, because it's based on asp.net SiteMapDataSource, and it also handles the information about permissions applied to pages, their ShowInNavigation property and culture. It will always return the correct pages.
Greetings,
Randy Hodge
the Telerik team