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 am having a problem with my main menu navigation code.
The navigation builds fine but whenever you switch to a particular sub page that sections menu no longer is rendered.
The menu CSHTML is on the master template and here is the code. The website to view yourself is http://seal-krete.habanero.com.
<umbraco:Macro runat="server" language="cshtml"> @inherits umbraco.MacroEngines.DynamicNodeContext @{ var level = String.IsNullOrEmpty(Parameter.Level) ? 1 : int.Parse(Parameter.Level); var parent = @Model.AncestorOrSelf(level); if (parent != null) { <ul id="nav"> @foreach (var item in parent.Children.Where("Visible")) { var selected = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? " class=\"selected\"" : ""; <[email protected](selected) class="parentOfDropDown"> <a href="@item.Url">@item.Name</a> @if (item.Children != null) { <ul class="dropDown"> @foreach (var sub in item.Children) { <li> <a href="@sub.Url">@sub.Name</a> <ul> @foreach (var subItem in sub.Children) { <li> <a href="@subItem.Url">@subItem.Name</a> </li> } </ul> </li> } </ul> } </li> } </ul> } } </umbraco:Macro>
Seems to work on the website. Might be good to read this topic about menu's in Razor: http://our.umbraco.org/forum/developers/razor/28479-Razor-menu-performance-(v4)
Jeroen
Yes this navigation works when on the home page but if you click on one of the subpages IE: Garage Floors, then try to hover over garage floors again when inside the page the drop down no longer is there.
Wow.. I am dumb. Sorry.
When I added the class selected to the drop down link the CSS I was using to show the drop down broke.
Stupid thread is stupid. haha.. Well if anything someone can use the above code to create a drop down :)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
cshtml main menu navigation problem.
Hi all. I am having a problem with my main menu navigation code.
The navigation builds fine but whenever you switch to a particular sub page that sections menu no longer is rendered.
The menu CSHTML is on the master template and here is the code. The website to view yourself is http://seal-krete.habanero.com.
Seems to work on the website. Might be good to read this topic about menu's in Razor: http://our.umbraco.org/forum/developers/razor/28479-Razor-menu-performance-(v4)
Jeroen
Yes this navigation works when on the home page but if you click on one of the subpages IE: Garage Floors, then try to hover over garage floors again when inside the page the drop down no longer is there.
Wow.. I am dumb. Sorry.
When I added the class selected to the drop down link the CSS I was using to show the drop down broke.
Stupid thread is stupid. haha.. Well if anything someone can use the above code to create a drop down :)
is working on a reply...