Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Apr 23, 2012 @ 10:59
    Rasmus Fjord
    0

    Simple .Where not working

    Hey there 

    The line under wont work. "currentMemberName" is a var with a string value in.

    @parentNode.Children.Where("Name.Equals(currentMemberName)").Count()

    It works if does this but the its not a var but just a string equal

    @parentNode.Children.Where("Name == \"s1\" ").Count()

     

  • Dave Woestenborghs 3325 posts 11170 karma points MVP 5x admin c-trib
    Apr 23, 2012 @ 11:19
    Dave Woestenborghs
    0

    Can you try this one

    @parentNode.Children.Where(c => c.Name.Equals(currentMemberName)).Count()

    Dave

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Apr 23, 2012 @ 11:21
    Rasmus Fjord
    0

    Im just gettin a Error loading MacroEngine script

    Is there something special i need to do before lambda expressions work ? 

     

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Apr 23, 2012 @ 11:23
    Rasmus Fjord
    0

    wooohhooo 

    got it workin 

     

    <p>@parentNode.Children.Where("Name.Equals(@0)",currentMemberName).Count()</p>    
  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Apr 23, 2012 @ 12:40
    Jeroen Breuer
    0

    Beware that using .Where might have some performance problems: http://our.umbraco.org/forum/developers/razor/28479-Razor-menu-performance-(v4)

    Jeroen

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Apr 23, 2012 @ 12:44
    Rasmus Fjord
    0

    oh okay Thx for the heads up ill remember it for future ref.

    In this example there will max be 10 elements in the list so we should be okay.

  • 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