Copied to clipboard

Flag this post as spam?

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


  • Pete 213 posts 285 karma points
    Oct 22, 2012 @ 19:10
    Pete
    0

    Select where name starts with certain letter?

    How can I do this? closest I've got is:

    pagesToList = @Model.children.Where("Name = @0", LettertoLookup)

    Thanks,pete

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

    You can do this :

    @{
    var pagesToList = Current.GetChildrenAsList.Items.Where(node => node.Name.StartsWith(LettertoLookup)).ToList();
    }
  • Pete 213 posts 285 karma points
    Oct 23, 2012 @ 12:44
    Pete
    0

    Thanks dawoe, but I get a:

    Cannot use a lambda expression as an argument to a dynamically 
    dispatched operation without first casting it to a delegate or 
    expression tree type

    error when I use that?

  • Pete 213 posts 285 karma points
    Oct 23, 2012 @ 12:55
    Pete
    0

    This is what I ended up using, thanks for your help, it got me started! Pete.

    DynamicNode n = @Model;
     List<DynamicNode> nl = @Model.Children.Items;
       foreach(dynamic item in nl.Where(x => x.Name.StartsWith(currentLetter))){
         <p>@item.Name</p>
       }
  • 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