More in this section

Forums / Developing with Sitefinity / Custom Menu help

Custom Menu help

4 posts, 0 answered
  1. Michael
    Michael avatar
    31 posts
    Registered:
    07 Sep 2007
    11 Oct 2009
    Link to this post
    I have been going through the Sitefinty API documentation trying to make a custom menu, but I have run into some problems.  I have been able to get all of the pages of the root, but I can't get anything below that.  This is what I am trying to acheive:

    <ul class="root"
         <li >PageName 
                <ul class="level_2"
                   <li>Page Name 
                       <ul class="level_3"
                            <li>Page Name</li> 
                       </ul> 
                    </li> 
                </ul> 
          </li> 
      </ul> 

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Oct 2009
    Link to this post
    Hi Michael,

    You can cast SiteMap node to CmsSiteMapNode and then access the child nodes using ChildNodes property of SiteMapNodeColllection, ParentNode of CmsSiteMapNode  and IcmsUrlContext Parent property.
    Currently you have the parents. You need to chenck whether threre are any child nodes and bind them. If you get stuck it will be great to share some code with us. This will help us to figure out wthat the exact problem is.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Michael
    Michael avatar
    31 posts
    Registered:
    07 Sep 2007
    11 Oct 2009
    Link to this post
    This is my current code.  Can I build off this or do I have to use the sitemap?

    using System; 
    using System.Collections; 
    using Telerik.Cms; 
     
    public partial class test : System.Web.UI.Page 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            CmsManager manager = new CmsManager(); 
            IList pages = manager.GetPages(); 
     
            foreach (ICmsPage page in pages) 
            { 
                Response.Write(page.Title + "<br />"); 
            } 
     
        } 

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Oct 2009
    Link to this post
    Hello Michael,

    You can use ICms page Parent property. The title is empty string. You can use MenuName. You should better work with CmsSiteMapNode and SiteMap classes.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered