In my GlassMapper model I'm getting the children of the current page using the following declaration:

public IEnumerable<BasePage> Subpages => GetChildren<BasePage>(TemplateId);

Is there a similar method I could use to get the properties of the parent of the current page into a BasePage model? I can use the template ID of this item to get the Sitecore.Data.Items.Item parent of the page, but when I have this item I've been unable to convert it back into the BasePage model.

2 Answers 2


You can use the [SitecoreParent] attribute for that:

public virtual BasePage Parent { get; set; }

It is also mentioned in the Tutorial 17 (http://www.glass.lu/mapper/sc/tutorials/tutorial17)

  • Yep, this is what I was looking for. Thanks!
    – c-bro
    Dec 30, 2016 at 20:15
  • 1
    to get parent of parent ?
    – user4124
    Dec 6, 2018 at 15:29

This is what I've come up with up to this point. It's working for me, but I'm unsure if there is a more direct way to grab the parent item:

public virtual BasePage getParent()
    ISitecoreContext context = SitecoreContext.GetFromHttpContext();
    return context.Cast<BasePage>(Sitecore.Context.Database.GetItem(this.Id.ToString()).Parent);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.