Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to get all blog items containing a tag taken from a tag querystring.
I have this:
var blogItems = Umbraco.TypedContent(Model.Content.Id).Children.Where(x => x.DocumentTypeAlias == "BlogItem" && x.IsVisible() && x => x.GetPropertyValue<string>("tagsList").Split(",").Contains(tags)).OrderByDescending(x => x.CreateDate);
But I am getting an CS1026: ) expected error
CS1026: ) expected error
So basically I want to get all items where "tag" is in the "tagsList" textfield on the blogItem
Hi
I think your query just has a few syntax issue - below should work:
var blogItems = Umbraco.TypedContent(Model.Content.Id) .Children.Where(x => x.DocumentTypeAlias == "BlogItem" && x.IsVisible() && x.GetPropertyValue<string>("tagsList").Split(',').Contains(tags)) .OrderByDescending(x => x.CreateDate);
(the second x => to just x, and Split(",") becomes Split(','))
umbraco does also have helper functions for tags such as
Umbraco.TagQuery.GetContentByTag(tag);
that might help, but i am not sure if you can do multiple tags in the same query with that.
is working on a reply...
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.
Continue discussion
Getting all items containing tag in CSV list
I am trying to get all blog items containing a tag taken from a tag querystring.
I have this:
But I am getting an
CS1026: ) expected error
So basically I want to get all items where "tag" is in the "tagsList" textfield on the blogItem
Hi
I think your query just has a few syntax issue - below should work:
(the second x => to just x, and Split(",") becomes Split(','))
umbraco does also have helper functions for tags such as
that might help, but i am not sure if you can do multiple tags in the same query with that.
is working on a reply...
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.