Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Daniel 5 posts 75 karma points
    Mar 09, 2018 @ 13:35
    Daniel
    0

    Please HELP Nav menu with select doc type in drop down menu.

    I'm trying to make an nav menu that has the children of the page all listed out with one document type being added to a drop down menu. How can i do something like get element and add the list item to the drop down list in stead of the outer nav list

    <div class="navbar-collapse collapse">
    <ul class="nav navbar-nav  navbar-right">
        <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">Products <span class="caret"></span></a>
            <ul class="dropdown-menu" id="markets"></ul>
            @foreach (var item in selection)
            {
                if (item.IsDocumentType("market"))
                {
                    @*Add to drop down list*@
                }
                else
                {
                    <a class="nav-link @(item.IsAncestorOrSelf(Model.Content) ? "nav-link--active" : null)" href="@item.Url">@item.Name</a>
                }
    
            }
        </li>
    </ul>
    

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Mar 13, 2018 @ 11:32
    Alex Skrypnyk
    0

    Hi Daniel

    Can you show, please, how dropdown looks in Umbraco backend? Is it a property of current node?

    /Alex

  • Daniel 5 posts 75 karma points
    Mar 13, 2018 @ 11:57
    Daniel
    0

    Thanks for the replay Alex i ended up doing the below> This is not a back office drop down it's for my sites main nav.

    <div class="navbar-collapse collapse">
    <ul class="nav navbar-nav  navbar-right">
    
        <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">Products <span class="caret"></span></a>
            <ul class="dropdown-menu">
                @foreach (var item in selection.Where(m => m.IsDocumentType("market")))
                {
                    <li><a href="@item.Url">@item.Name</a></li>
                }
                <li><a href="http://brake.sepro.com">Agriculture</a></li>
                <li><a href="http://diy.sepro.com/">DIY Aquatics</a></li>
            </ul>
        </li>
    
        @foreach (var item in selection.Where(m => !m.IsDocumentType("market")))
        {
            <li><a href="@item.Url">@item.Name</a></li>
        }
    </ul>
    

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Mar 13, 2018 @ 12:22
    Alex Skrypnyk
    0

    Thanks for sharing, Daniel.

Please Sign in or register to post replies

Write your reply to:

Draft