Copied to clipboard

Flag this post as spam?

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


  • Jhon 87 posts 162 karma points
    Apr 24, 2018 @ 10:45
    Jhon
    0

    It is displaying error

    Hi

    I have written this code . It is getting some error. Caan you please look at my code and error.

    enter image description here

    See errror output:

    enter image description here

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 24, 2018 @ 10:48
    Alex Skrypnyk
    0

    Hi Jhon

    Can you paste code as code ? :)

    Hard to fix from image.

    Thanks,

    Alex

  • Jhon 87 posts 162 karma points
    Apr 24, 2018 @ 10:53
    Jhon
    0

    @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>
    
  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 24, 2018 @ 11:00
    Alex Skrypnyk
    0
    @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>
    
  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 24, 2018 @ 11:00
    Alex Skrypnyk
    0

    This one should work.

  • Jhon 87 posts 162 karma points
    Apr 24, 2018 @ 11:05
    Jhon
    0

    See error again, enter image description here

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 24, 2018 @ 11:19
    Alex Skrypnyk
    0
      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";
                                        }
    
  • Jhon 87 posts 162 karma points
    Apr 24, 2018 @ 11:36
    Jhon
    0

    Thank you so much

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 24, 2018 @ 11:42
    Alex Skrypnyk
    0

    you are welcome, glad that topic is solved.

    Have a great evening

Please Sign in or register to post replies

Write your reply to:

Draft