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%)?
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
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
Doesn't .Contains(XXX) just replace .Equals(XXX) ??
is working on a reply...