Redirect page not showing up in Sitemap?
Hey all,
Running in to an odd issue here - when using the page as a Standard page, the navigation shows the link and page correctly. Changing it to a Redirect page (internal redirect to a different page in the Sitemap) instantly removes the link from the navigation. Currently, using the code below for 2-level dropdowns (feel free to use =))
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MainNav.ascx.cs" Inherits="Custom_Widgets_MainNav" %><asp:SiteMapDataSource ID="TopNavStart" runat="server" ShowStartingNode="false" /><asp:Repeater runat="server" ID="LeftNav" DataSourceID="TopNavStart" OnItemDataBound="FirstLevel_ItemDataBound"> <HeaderTemplate> <ul> </HeaderTemplate> <ItemTemplate> <li class="links"> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Url") %>' Text='<%# Eval("Title") %>'></asp:HyperLink> <asp:Repeater runat="server" ID="SecondLevel" OnItemDataBound="SecondLevel_ItemDataBound"> <HeaderTemplate><ul class="firstDrop"></HeaderTemplate> <ItemTemplate> <li> <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("Url") %>' Text='<%# Eval("Title") %>'></asp:HyperLink> <asp:Repeater runat="server" ID="ThirdLevel"> <HeaderTemplate><ul></HeaderTemplate> <ItemTemplate> <li> <asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl='<%# Eval("Url") %>' Text='<%# Eval("Title") %>'></asp:HyperLink> </li> </ItemTemplate> <FooterTemplate></ul></FooterTemplate> </asp:Repeater> </li> </ItemTemplate> <FooterTemplate></ul></FooterTemplate> </asp:Repeater> </li> </ItemTemplate> <FooterTemplate> </ul> </FooterTemplate></asp:Repeater>public partial class Custom_Widgets_MainNav : System.Web.UI.UserControl protected void Page_Load(object sender, EventArgs e) protected void FirstLevel_ItemDataBound(object sender, RepeaterItemEventArgs e) if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) //Check for "Show In Navigation" in Sitefinity SiteMap var data = e.Item.DataItem as PageSiteNode; if (data != null) if (data.ShowInNavigation == false) e.Item.Visible = false; if (data.IsGroupPage == true) //e.Item.Visible = false; //Bind nested repeat for dropdowns if (((SiteMapNode)e.Item.DataItem).ChildNodes.Count > 0) Repeater nestedRepeater = e.Item.FindControl("SecondLevel") as Repeater; if (nestedRepeater != null) nestedRepeater.DataSource = ((SiteMapNode)e.Item.DataItem).ChildNodes; nestedRepeater.DataBind(); protected void SecondLevel_ItemDataBound(object sender, RepeaterItemEventArgs e) if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) //Check for "Show In Navigation" in Sitefinity SiteMap var data = e.Item.DataItem as PageSiteNode; if (data != null) if (data.ShowInNavigation == false) e.Item.Visible = false; if (data.IsGroupPage == true) e.Item.Visible = false; //Bind nested repeat for dropdowns if (((SiteMapNode)e.Item.DataItem).ChildNodes.Count > 0) Repeater nestedRepeater = e.Item.FindControl("ThirdLevel") as Repeater; if (nestedRepeater != null) nestedRepeater.DataSource = ((SiteMapNode)e.Item.DataItem).ChildNodes; nestedRepeater.DataBind(); Hello Brad,
I per your description using it as Custom template path for horizontal navigation with 2 level dropdowns breaks and I am unable view the pages because of an error unable to find BaseDataBoundControl derived control the template.
I used your code and installed that navigation as widget to be used on pages and all was great redirect pages were showing. Note when you design a user control to be used as Custom template for navigation you don`t need to define sitemap because it will use the sitemap provided with Sitefinity navigation widget. When you create a user control that will be dragged and dropped as a replacement for the navigation widget then you will need SiteMapDataSource.
You can use this code to create a control with dropdowns to be used as Custom template for navigation widget.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MainNav.ascx.cs" Inherits="SitefinityWebApp.Custom.MainNav" %><%@ Register TagPrefix="sf" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><telerik:RadMenu ID="RadMenu1" runat="server"></telerik:RadMenu>Stanislav,
Thank you for the clarification on this issue. RadMenu seems to work just fine when embedded stylesheets are removed, thus just generating the markup.
Thanks!