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 675 posts 1566 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 3504 posts 12134 karma points MVP 9x 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 675 posts 1566 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 675 posts 1566 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 4908 posts 12265 karma points MVP 5x 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 675 posts 1566 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.

Please Sign in or register to post replies

Write your reply to:

Draft