1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Redirect page not showing up in Sitemap?

Redirect page not showing up in Sitemap?

3 posts, 1 answered
  1. Brad
    Brad avatar
    28 posts
    Registered:
    20 Sep 2010
    21 Jun 2011
    Link to this post
    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>

    CodeBehind:

    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();
                    }
                }
            }
        }
    }
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    24 Jun 2011
    Link to this post
    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>

    Please provide some more clarifications on how your control should work so I can be of help to you.

    Regards,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Brad
    Brad avatar
    28 posts
    Registered:
    20 Sep 2010
    05 Jul 2011
    Link to this post
    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!

3 posts, 1 answered