Copied to clipboard

Flag this post as spam?

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


  • UmbracoNewb 31 posts 53 karma points
    Nov 11, 2011 @ 14:37
    UmbracoNewb
    0

    IsHelpers not working?

    Hi

    Trying to learn Razor, now that XSLT have been decapitated. I am making a fairly simple navigation and would like to check for the last element in my foreach using the IsNotLast:

    @{var footerLinks Model.NodeById(1214).Children;}
    <ul>
    @foreach(var lvl in footerLinks)
    {
      if(lvl.HasAccess){
        <li>
          <href="@lvl.Url">@lvl.Name</a>
          @lvl.IsNotLast("|")
          @*@if(lvl != footerLinks.Last()){
            <text>|</text>                              
          }*@
        </li>
      }                  
    }
    </ul>

     

    @lvl.IsNotLast("|") is giving me an error frontend: Error loading Razor Script green_solutionFooterLinksRZ.cshtml

    Cannot invoke a non-delegate type

    I can go with the out commented section, wit the if condition, the other option just seems smarter. But what is wrong, why am I getting an error? Site is Umbraco 4.7.1

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Nov 17, 2011 @ 20:08
    Sebastiaan Janssen
    0

    I was not aware that this would be a valid call.. but, I've just tested it and it seems to work fine! I think you're using 4.7.0, you should upgrade to 4.7.1 to use the IsHelpers. :)

  • 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