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 3504 posts 12135 karma points MVP 9x 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>
       }
Please Sign in or register to post replies

Write your reply to:

Draft