Copied to clipboard

Flag this post as spam?

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


  • Cedeste 37 posts 129 karma points
    Jan 25, 2023 @ 15:45
    Cedeste
    0

    MeganavV8 with Umbraco 11.1

    New developer to Umbraco implementation.

    Trying to implement the MeganavV8.

    I started here: https://our.umbraco.com/packages/website-utilities/meganavv8/

    I created the MegaNav DataType to add to a composition so that I could add it to my HomePage for easy management.

    I'm able to create the links - including nested no issue.

    My problem comes on the partial view - see code:

    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
    @using Umbraco.Cms.Core
    @using Umbraco.Cms.Core.Models.PublishedContent
    @using Umbraco.Cms.Core.Routing
    @using Umbraco.Extensions
    
    @inject IPublishedValueFallback PublishedValueFallback
    @inject IPublishedUrlProvider PublishedUrlProvider
    
        <!-- Navigation -->
    
    @{
        var homePage = Umbraco.AssignedContentItem.AncestorOrSelf<HomePage>();
    
    }
    
    <nav class="navbar navbar-expand-lg navbar-light" id="mainNav">
                <div class="container px-4 px-lg-5">
                    <a class="navbar-brand" href="@homePage.Url()">Site Name</a>
                    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
                        Menu
                        <i class="fas fa-bars"></i>
                    </button>
                    <div class="collapse navbar-collapse" id="navbarResponsive">
    
                        <ul class="navbar-nav ms-auto py-4 py-lg-0">
    
                                    @foreach (var item in Model.Value<IEnumerable<MeganavV8Item>>("megaNavV8"))
                                    {
                                     <li class="nav-item"><a class="nav-link px-lg-3 py-3 py-lg-4" href="@item.Link.Url">@item.Title</a></li>
                                    }        
    
    
    
                        </ul>
    
                    </div>
                </div>
            </nav>
    

    When I run and refresh, I get the following error:

    The type or namespace name 'MeganavV8Item' could not be found (are you missing a using directive or an assembly reference?)
    +
                                    @foreach (var item in Model.Value<IEnumerable<MeganavV8Item>>("megaNavV8"))
    

    Keep in mind I am new to the implementation and have limited experience with razor code - can anyone tell me what I am doing wrong? What am I missing? Or can anyone point me to a tutorial with instructions and code examples so that I can teach myself?

    I'm finding that there is limited documentation don't the implementation of this tool... so it's been challenging, to say the least.

    Thanks in advance for the assistance!

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    Jan 26, 2023 @ 14:49
    Alex Skrypnyk
    0

    Hi Cedeste

    Check out the Models Builder settings, looks like Models Builder is not set correctly at your solution.

    https://our.umbraco.com/documentation/reference/templating/modelsbuilder/

    Thanks,

    Alex

  • Cedeste 37 posts 129 karma points
    Jan 26, 2023 @ 19:33
    Cedeste
    0

    Thank you! I will try that.

  • Nik 1625 posts 7295 karma points MVP 7x c-trib
    Jan 31, 2023 @ 22:48
    Nik
    0

    Hey Cedeste,

    I just wanted to flag, MegaNavV8 is not supported on Umbraco 9+. It was a package built for .Net Framework, where as Umbraco 9+ is .Net Core. There are alternative packages out there for Umbraco 9+

    UmbNav v1 was released to replace this package and supports Umbraco v8 and v9. V2 of UmbNav supports Umbraco 10 +.

    https://github.com/AaronSadlerUK/Our.Umbraco.UmbNav

    Thanks

    Nik

  • Cedeste 37 posts 129 karma points
    Feb 01, 2023 @ 13:13
    Cedeste
    0

    Thank you. I will take a look at the newer option.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies