More in this section

Forums / Developing with Sitefinity / Customizing RadMenu

Customizing RadMenu

7 posts, 0 answered
  1. viscious
    viscious avatar
    31 posts
    Registered:
    10 Aug 2006
    04 Jun 2007
    Link to this post
    Hello.  I need to make a radmenu (for site navigation) That only expands one level deep.

    So I basically need it to show all root level pages, and all of their immediate children only.


  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    05 Jun 2007
    Link to this post
    Hi Erick,

    The RadMenu control consists of items grouped in the Items collection. Each RadMenuItem can also contain an Items collection with its own child items and etc. So RadMenu is exactly what you need for your site navigation.
    Have a look at the RadMenu online help http://www.telerik.com/help/aspnet/menu/, maybe you will find some useful information there.
    If you have additional questions please don’t hesitate to ask.

    Regards,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    05 Jun 2007
    Link to this post
    Hi Erick,

    I am really sorry but initially I misinterpreted your question. So here is a quick follow-up.

    Yes, RadMenu gives the opportunity to show only the root level pages and all of their immediate children.

    Have a look at the RadMenu online help http://www.telerik.com/help/aspnet/menu/ -> ASP.NET 2.0 features -> Data Bindings.

    The DataBindings property of RadMenu is a collection that defines the relationship between a data item and the menu item it is binding to.

    <radM:RadMenu ID="RadMenu1" runat="server" DataSourceID="AccessDataSource1"
        DataFieldID="id" DataFieldParentID="parentId" DataTextField="Text">
        <DataBindings>
            <radM:MenuItemBinding EnabledField="" ImageUrl="" ImageUrlField="" NavigateUrl=""
                NavigateUrlField="" Selectable="True" SelectableField="" Target="" TargetField=""
                TextField="Text" ToolTip="" Value="" ValueField="" Depth="" ToolTipField="" />
        </DataBindings>
    </radM:RadMenu>


    For you the most important property of MenuItemBinding is Depth. It gets or sets the menu depth to which binding is applied.

    Hope this will help you.

    All the best,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. bnye
    bnye avatar
    332 posts
    Registered:
    22 Sep 2005
    05 Jun 2007
    Link to this post

    You can perform this in the skin .CSS with the RadTabstrip. This might be an alternative that works with the menu as well. For the tabstip this cvan be accomplished by hiding all items initially and then showing only the level1 items in the CSS file.

    .RadTabStrip_mainMenu li a  
    {  
        display: none;  
    }  
    .RadTabStrip_mainMenu .level1 li a  
    {  
         display: block;  

    Sincerely,

    Ben
  5. viscious
    viscious avatar
    31 posts
    Registered:
    10 Aug 2006
    05 Jun 2007
    Link to this post
    Ok I tried to use the databindings method you mentioned, but it isn't quite working.

    Here is the code I tried.

    <asp:SiteMapDataSource ID="SiteMapDataSource1" ShowStartingNode="false" runat="server" /> 
    <radM:RadMenu ID="RadMenu1" runat="server" UseEmbeddedScripts="false" Skin="fam" DataSourceID="SiteMapDataSource1"
            <DataBindings> 
                <radM:RadMenuItemBinding Depth="0" TextField="MenuTitle" NavigateUrlField="Url" /> 
                <radM:RadMenuItemBinding Depth="1" TextField="MenuTitle" NavigateUrl="Url" /> 
                <radM:RadMenuItemBinding Depth="2" Enabled="false" />                    
            </DataBindings> 
        </radM:RadMenu> 
     

    This code is in a master page.
  6. viscious
    viscious avatar
    31 posts
    Registered:
    10 Aug 2006
    05 Jun 2007
    Link to this post
    oops, I forgot to mention the problem.

    What happens is, the first and second level work correctly.  But the third level expands and all the items are blank.  What I really need it to do is have it set so the Third level doesnt expand at all.


  7. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    06 Jun 2007
    Link to this post
    Hi Erick,

    We can offer you to use OnItemDataBound event to control the menu items. For example:

    <asp:SiteMapDataSource ID="SiteMapDataSource1" ShowStartingNode="false" runat="server" />
    <radM:RadMenu ID="RadMenu1" DataSourceID="SiteMapDataSource1" runat="server"        OnItemDataBound="RadMenu1_ItemDataBound">
      </radM:RadMenu>

    <script runat="server">
        protected void RadMenu1_ItemDataBound(object sender, Telerik.WebControls.RadMenuEventArgs e)
        {
            if (e.Item.Level >= 2)
            {
                e.Item.Visible = false;
                e.Item.Owner.Items.Clear();
            }
           
        }
    </script>

    Hope this helps you. Please let us know if you need any further assistance.

    Sincerely yours,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
7 posts, 0 answered