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,
I have a related content partial view that gets similar animal pages to the one the user has selected:
@foreach (var page in Umbraco.Content("1061").DescendantsOrSelf("Animal"))
{}
Is there any way to tell it "Where ID is not = to current page ID?" i dont want to see the current page in the related section choices.
Thanks guys,
J
P.S. I am using Umbraco.Content(1061) sot hat i can stick the partial view anywhere on my site.
TY
Hi James,
I think that you could do something like this
@{ var currentPageId = CurrentPage.Id; foreach (var page in Umbraco.Content("1061").DescendantsOrSelf("Animal").Where("Visible && Id != @0",currentPageId)){ // Do something } }
And here you can find the documentation https://our.umbraco.org/Documentation/Reference/Mvc/querying#Complexquerying%28Where%29
Hope this helps,
/Dennis
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Id of current page
Hello,
I have a related content partial view that gets similar animal pages to the one the user has selected:
@foreach (var page in Umbraco.Content("1061").DescendantsOrSelf("Animal"))
{}
Is there any way to tell it "Where ID is not = to current page ID?" i dont want to see the current page in the related section choices.
Thanks guys,
J
P.S. I am using Umbraco.Content(1061) sot hat i can stick the partial view anywhere on my site.
TY
Hi James,
I think that you could do something like this
And here you can find the documentation https://our.umbraco.org/Documentation/Reference/Mvc/querying#Complexquerying%28Where%29
Hope this helps,
/Dennis
is working on a reply...