Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all,
I had this navigation partial view working in Umbraco8, but doesnt seem to work on Umbraco 9
@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 @{ var selection = Umbraco.ContentAtRoot().FirstOrDefault() .Children() .Where(x => x.IsVisible()); } <div data-collapse="medium" data-animation="default" data-duration="400" class="navbar w-nav"> <nav role="navigation" class="nav-menu w-nav-menu"> <a href="/" class="link-block w-inline-block w--current"><img src="~/images/home_1home.png" alt="Home"></a> @foreach (var item in selection) { var children = item.Children(c => c.IsVisible()).ToArray(); if (!item.Value<bool>("disableDropdown") && (children.Any())) { <div data-hover="1" data-delay="0" class="dropdown-link w-dropdown"> <div class="dropdown-toggle w-dropdown-toggle"> <div class="testt">@item.Name</div> </div> <nav class="w-dropdown-list"> @foreach (var child in children) { <a href="@child.Url" class="nav-link w-dropdown-link">@child.Name</a> } </nav> </div> } else { <a href="@item.Url" class="nav-link w-nav-link">@item.Name</a> } } </nav> <div data-ix="triangle-nav" class="triangle-nav-button w-nav-button"> <div class="triangle"></div> </div> </div>
But Im getting the following error when trying to use it in umbraco 9?
Hi Matt,
De .Url variable doesn't exists anymore in v9. You now have to use the method .Url()
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Code not working on Umbraco 9
Hi all,
I had this navigation partial view working in Umbraco8, but doesnt seem to work on Umbraco 9
But Im getting the following error when trying to use it in umbraco 9?
Hi Matt,
De .Url variable doesn't exists anymore in v9. You now have to use the method .Url()
is working on a reply...