Developer forum

Forum » CMS - Standard features » Get parent ID from page template

Get parent ID from page template

Lars Pham
Reply

Yo!

Is it possible to get the parent pageID from a subpage on the page template? 

  • Page A
    • Subpage 1
    • Subpage 2 (I want to retrieve the page ID from "Page A" from a page template here)
  • Page B

 


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Yo :-)

You have 2 options at least:

If you are inside a template or in a frontend context:

Dynamicweb.Frontend.PageView.Current().Page.Parent.ID;

Or if you are anywhere else and have a pageid:

Dynamicweb.Services.Pages.GetPage(123).Parent.ID;
Votes for this answer: 1

 

You must be logged in to post in the forum