BreadCrumb Menu Path with nodes

2 posts, 0 answers
  1. Dhyan
    Dhyan avatar
    27 posts
    Member since:
    Feb 2016

    Posted 02 Mar Link to this post

    Hi

     

    I am using  http://demos.telerik.com/aspnet-ajax/menu/examples/functionality/templates/defaultcs.aspx to generate menu

    How can i use the bread crumb up to the level RadSiteMapNode. I was using following code sample  but not working 

     

    using System;
    using System.Collections.Generic;
    using Telerik.Web.UI;
      
    namespace Menu.Examples.Programming.ShowPath
    {
        public partial class DefaultCS : System.Web.UI.Page
        {
            //If RadMenu is data bound, please use its DataBound event instead of PageLoad.
            protected void Page_Load(object sender, EventArgs e)
            {
                RadMenuItem currentItem = RadMenu1.FindItemByUrl(Request.Url.PathAndQuery);
                if (currentItem != null)
                {
                    //Select the current item and his parents
                    currentItem.HighlightPath();
                    //Update the title of the
                    PageTitleLiteral.Text = currentItem.Text;
                    //Populate the breadcrumb
                    DataBindBreadCrumbSiteMap(currentItem);
                }
                else
                    RadMenu1.Items[0].HighlightPath();
                      
            }
      
            private void DataBindBreadCrumbSiteMap(RadMenuItem currentItem)
            {
                List<RadMenuItem> breadCrumbPath = new List<RadMenuItem>();
                while (currentItem != null)
                {
                    breadCrumbPath.Insert(0, currentItem);
                    currentItem = currentItem.Owner as RadMenuItem;
                }
                BreadCrumbSiteMap.DataSource = breadCrumbPath;
                BreadCrumbSiteMap.DataBind();
            }
        }
    }

    <telerik:RadMenu RenderMode="Lightweight" runat="server" ID="RadMenu1" Skin="Glow">
                <DefaultGroupSettings Height="270px" />
                <Items>
                    <telerik:RadMenuItem Text="Asia">
                        <ContentTemplate>
                            <telerik:RadSiteMap runat="server" ID="RadSiteMap1" Skin="Glow" CssClass="itemContent asia">
                                <DefaultLevelSettings ListLayout-RepeatColumns="3"></DefaultLevelSettings>
                                <Nodes>
                                    <telerik:RadSiteMapNode Text="Afghanistan"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Bangladesh"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Cambodia"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="China"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="India"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Indonesia"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Iran"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Iraq"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Japan"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Maldives"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Philippines"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Saudi Arabia"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Thailand"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="Yemen"></telerik:RadSiteMapNode>
                                    <telerik:RadSiteMapNode Text="United Arab Emirates"></telerik:RadSiteMapNode>
      
                                </Nodes>
                            </telerik:RadSiteMap>
                        </ContentTemplate>
                    </telerik:RadMenuItem>
         </Items>
    </telerik:RadMenu>

  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    278 posts

    Posted 07 Mar Link to this post

    Hi Dhyan,

    Could you, please give us a bit more details about your implementation:
    - Give us the markup for the control with ID="BreadCrumbSiteMap";
    - Give us the markup for the control with ID="PageTitleLiteral";
    - Explain what would you like to render / achieve using breadcrumb;

    I am looking forward to your replay.

    Regards,
    Veselin Tsvetanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top