Lanceomagnifico
Lanceomagnifico

Reputation: 1303

How to get the parent page of a PageDefinitionTypePlugIn property in EPiServer?

I've got a [PageDefinitionTypePlugIn] PropertyString (it's a dropdownlist), and I'd like to be able to detect what it's parent page is. Generally, Global.EPDataFactory.CurrentPage works fine to return the page, but when a NEW page is being created, CurrentPage returns null.

I need to know prior to the render of the control what the parent is, since I'm changing the list of values in the dropdown depending on where the current page is in the navigation heirarchy structure.

Thanks, Lance

Upvotes: 1

Views: 1632

Answers (1)

Daniel
Daniel

Reputation: 391

protected void Application_Start( object sender, System.EventArgs e ) {
 EPDataFactory.CreatingPage += new EPiServer.PageEventHandler( OnCreatingPage );
}

private void OnCreatingPage( object sender, EPiServer.PageEventArgs e ) {
  e.TargetLink <-- should be the parent
}

Upvotes: 2

Related Questions