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
Hello,
So I have a doctype and I'm using the following query to show the all the nodes which works fine.
@{ var selection = Umbraco.Content(Guid.Parse("5c3471d3-b088-4d67-8188-0a9795a3c93e")) .Children() .Where(x => x.IsVisible()); } <ul> @foreach (var item in selection) { <li> <a href="@item.Url">@item.Name</a> </li> } </ul>
However what I want to do is I've got a tag property called "boardType" and I want to only show nodes where the tag is called e.g Executive how could I achieve this?
Thanks
Hi Matt.
This is untested, but i think you can extend your where clause with this.
.Where(x => x.IsVisible() && x.Value<string[]>("boardType").Contains("Executive"));
If you are using culture variants you need to add culture to the value after "boardType" like x.Value<string[]>("boardType", "en-US")
x.Value<string[]>("boardType", "en-US")
Thats perfect thanks, if I wanted to do same for dropdown would I simply use same code but just change the property name?
I think the dropdown represents a string so it would be something like this x.Value<string>("boardType") == "Executive"
x.Value<string>("boardType") == "Executive"
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
display nodes if Tag has x value
Hello,
So I have a doctype and I'm using the following query to show the all the nodes which works fine.
However what I want to do is I've got a tag property called "boardType" and I want to only show nodes where the tag is called e.g Executive how could I achieve this?
Thanks
Hi Matt.
This is untested, but i think you can extend your where clause with this.
If you are using culture variants you need to add culture to the value after "boardType" like
x.Value<string[]>("boardType", "en-US")
Thats perfect thanks, if I wanted to do same for dropdown would I simply use same code but just change the property name?
I think the dropdown represents a string so it would be something like this
x.Value<string>("boardType") == "Executive"
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.