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
I have written this code . It is getting some error. Caan you please look at my code and error.
See errror output:
Hi Jhon
Can you paste code as code ? :)
Hard to fix from image.
Thanks,
Alex
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ var navFolder = Umbraco.TypedContent(1150); string siteURL = Request.Url.ToString(); string splitTag = siteURL.Split('/')[3];
var deoLogo = Umbraco.TypedContent(1150);
}
<div id="header-wrapper"> <header id="header"> <div class="inner"> <div class="topBar"> <div style="float: right;padding-right:15px;"> <nav id="nav"> <ul class="navList"> @foreach (var item in navFolder.Children.Where(x => x.DocumentTypeAlias == "indholdmappe")) { string categoryColor = "#" + @item.tagcolor; var red = int.Parse(@item.tagcolor.Substring(0, 2), NumberStyles.AllowHexSpecifier); var green = int.Parse(@item.tagcolor.Substring(2, 2), NumberStyles.AllowHexSpecifier); var blue = int.Parse(@item.tagcolor.Substring(4, 2), NumberStyles.AllowHexSpecifier); var color = ""+red+","+green+","+blue+""; if ([email protected]) { if (@splitTag == @item.Url.Split('/')[3] || @splitTag.Contains("search.aspx") || @splitTag == "" || @splitTag == "om-deo" || @splitTag == "kontakt" || @splitTag == "presse") { <li id="navColor" style="background-color: rgb(@color); opacity: 1;" class="current_page_item"> } else { <li id="navColor" style="background-color: rgb(@color); opacity: 0.5;"> } if (@item.Name == "Undervisningen") { <a id="outerA" href="@item.Url">undervisning</a> } else { <a id="outerA" href="@item.Url">@item.Name</a> } </li> <div style="clear:both;"></div> } } </ul> </nav> </div> </div> </div> </header> </div>
@using System.Globalization @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ var navFolder = Umbraco.TypedContent(1150); string siteURL = Request.Url.ToString(); string splitTag = siteURL.Split('/')[3]; //var deoLogo = Umbraco.TypedContent(1150); } <div id="header-wrapper"> <header id="header"> <div class="inner"> <div class="topBar"> <div style="float: right;padding-right:15px;"> <nav id="nav"> <ul class="navList"> @foreach (var item in navFolder.Children.Where(x => x.DocumentTypeAlias == "indholdmappe")) { //string categoryColor = "#" + item.GetPropertyValue<string>("tagcolor"); var red = int.Parse(item.GetPropertyValue<string>("tagcolor").Substring(0, 2), NumberStyles.AllowHexSpecifier); var green = int.Parse(item.GetPropertyValue<string>("tagcolor").Substring(2, 2), NumberStyles.AllowHexSpecifier); var blue = int.Parse(item.GetPropertyValue<string>("tagcolor").Substring(4, 2), NumberStyles.AllowHexSpecifier); var color = "" + red + "," + green + "," + blue + ""; if (item.IsVisible()) { var currentPageItemClass = ""; if (splitTag == item.Url.Split('/')[3] || splitTag.Contains("search.aspx") || splitTag == "" || splitTag == "om-deo" || splitTag == "kontakt" || splitTag == "presse") { currentPageItemClass = "current_page_item"; } <li id="navColor" style="background-color: rgb(@color); opacity: 1;" class="@currentPageItemClass"> @if (item.Name == "Undervisningen") { <a id="outerA" href="@item.Url">undervisning</a> } else { <a id="outerA" href="@item.Url">@item.Name</a> } </li> <div style="clear:both;"></div> } } </ul> </nav> </div> </div> </div> </header> </div>
This one should work.
See error again,
var currentPageItemClass = ""; if (item.Url.Split('/').Length > 3 && splitTag == item.Url.Split('/')[3]) { currentPageItemClass = "current_page_item"; } if (splitTag.Contains("search.aspx") || splitTag == "" || splitTag == "om-deo" || splitTag == "kontakt" || splitTag == "presse") { currentPageItemClass = "current_page_item"; }
Thank you so much
you are welcome, glad that topic is solved.
Have a great evening
is working on a reply...
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.
Continue discussion
It is displaying error
Hi
I have written this code . It is getting some error. Caan you please look at my code and error.
See errror output:
Hi Jhon
Can you paste code as code ? :)
Hard to fix from image.
Thanks,
Alex
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ var navFolder = Umbraco.TypedContent(1150); string siteURL = Request.Url.ToString(); string splitTag = siteURL.Split('/')[3];
}
This one should work.
See error again,
Thank you so much
you are welcome, glad that topic is solved.
Have a great evening
is working on a reply...
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.