Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Candaele 1197 posts 2049 karma points
    Feb 27, 2014 @ 09:42
    Anthony Candaele
    0

    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:

    enter image description here

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Feb 27, 2014 @ 10:53
    Anthony Candaele
    0

    I tried to adjust my Razor query:

    var members = Model.Content.Descendants("Homepage").Where(x => x.DocumentTypeAlias == "MemberItem");
    

    But that didn't work either.

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 27, 2014 @ 13:05
    Fuji Kusaka
    0

    This should work

    var members = Model.AncestorOrSelf(1).Descendants("MemberItem").Items

     

     

  • 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.

Please Sign in or register to post replies