Is there a simple way to set ListingContainer on a newly created page to point to itself? Or do I have to save the page first, then change the ListingContainer, then publish the page? The following does not work correctly:
EPiServer.Core.PageData newPage = Global.EPDataFactory.GetDefaultPageData(parentPage.PageLink, 3);
newPage.PageName = "New listing page";
newPage["ListingContainer"] = newPage.PageLink;
PageReference newPageRef = EPiServer.Global.EPDataFactory.Save(newPage, EPiServer.DataAccess.SaveAction.Publish);
Hi!
Use the static member SelfReference property of PageReference for this:
newPage.PageName = "New listing page";
newPage["ListingContainer"] = PageReference.SelfReference;
Regards,
Johan Olofsson
Developer
ElektroPost
EPiServer.Core.PageData newPage = Global.EPDataFactory.GetDefaultPageData(parentPage.PageLink, 3); newPage.PageName = "New listing page"; newPage["ListingContainer"] = newPage.PageLink; PageReference newPageRef = EPiServer.Global.EPDataFactory.Save(newPage, EPiServer.DataAccess.SaveAction.Publish);