Copied to clipboard

Flag this post as spam?

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


  • Hugh 30 posts 64 karma points
    Feb 16, 2014 @ 04:29
    Hugh
    0

    Razor Lambda text like search

    Hi

    I have a Partial View Macro that i want to pass a search paramater to and find all nodes that have a pageheading where the search value is like or is contained.  Here is what i currently have that will do an exact match:

     var searchTerm = Request.QueryString["search"];
    var articleContainerId = 1089;
    IEnumerable<IPublishedContent> venues;
    venues = Umbraco.TypedContent(articleContainerId).Children.Where(x => x.GetPropertyValue("pageHeading".ToUpper()).Equals(@searchTerm));

    Is there a Lambda exression that i can use the will do a String.Contains(@SearchTerm) or Like(%@SearchTerm%)?

    Thanks

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 16, 2014 @ 13:15
    Dennis Aaen
    0

    Hi Hugh,

    If I understand correctly what you're trying to do is implement a site search for your site.

    For a search functionality on your site you could try use the ezSearch.

    http://our.umbraco.org/projects/website-utilities/ezsearch

    I hope this can help you, and do it much easier for you.

    /Dennis

  • Mike Chambers 636 posts 1253 karma points c-trib
    Feb 17, 2014 @ 10:29
    Mike Chambers
    0

    Doesn't .Contains(XXX) just replace .Equals(XXX) ??

Please Sign in or register to post replies

Write your reply to:

Draft