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
Hi,
I'm trying to get a collection of member items (MemberItem) in Razor. My content tree looks like this:
I should list the members on the About Us page
therefore, on the About Us page, I include this Razor script:
var members = Model.Content.Descendants(0).Where(x => x.DocumentTypeAlias == "MemberItem");
I already tried AncestorsOrSelf, DescendantsOrSelf, ... but I'm not able to access the member items from the About Us page.
How can I get hold of the member items from the About Us page?
Thanks a lot for your help,
Anthony
I tried to adjust my Razor query:
var members = Model.Content.Descendants("Homepage").Where(x => x.DocumentTypeAlias == "MemberItem");
But that didn't work either.
This should work
var members = Model.AncestorOrSelf(1).Descendants("MemberItem").Items
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Razor issue getting collection of members
Hi,
I'm trying to get a collection of member items (MemberItem) in Razor. My content tree looks like this:
I should list the members on the About Us page
therefore, on the About Us page, I include this Razor script:
I already tried AncestorsOrSelf, DescendantsOrSelf, ... but I'm not able to access the member items from the About Us page.
How can I get hold of the member items from the About Us page?
Thanks a lot for your help,
Anthony
I tried to adjust my Razor query:
But that didn't work either.
This should work
is working on a reply...