November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Use this, where 999 is the page ID you want to retrieve:
EPiServer.Core.PageData otherPage = this.GetPage(new EPiServer.Core.PageReference(999);
Hi,
Thanks for the reply,
Is this will give all the property in page.In my page i have Name,Image,Ingress and link and want all these to be display in other page.
You can use the following syntax to get access to the individual property values:
otherPage["Ingress"];
otherPage["Image"];
etc
Another way is to use the EPiServer property control and set it's PageLink property to have it read from another page:
<EPiServer:Property runat="server" ID="ctlImageProperty" PropertyName="Image" PageLink="3" />
You can even make it read what source page to use from a property of the current page:
<EPiServer:Property runat="server" ID="ctlImageProperty" PropertyName="Image" PageLinkProperty="ImagePageLink" />
where ImagePageLink is a property of the Current Page of type Page which points to the page where the Image property is stored.
You can of course set these things from codebehind aswell:
override void OnLoad(EventArgs e)
{
base.OnLoad(e);
PageReference sourcePage = GetReferenceToPageContainingImage(); // Performs whatever logic you want
ctlImageProperty.PageLink = sourcePage;
}
etc...
Hi,
Thanks for the reply
I have a A page have 3 subpages and want to display the properties of three subpages in my A page,
EPiServer.Core.PageData otherPage = this.GetPage(new EPiServer.Core.PageReference(21));,
I have to write it for all the subpages which hardcoded id. Is there is any mothod called getchildren by which i get all the properties of children pages
How do I map all the pages property in my A page?
Hi,
I would suggest taking a look at http://sdk.episerver.com/library/cms6/index.aspx.
Use the search for see the different getchildren methods. But all of them returns page data objects, but from them you can get the properties.
Yes, DO read the SDK. In this special case though I would once again recommend using one of the EPiServer WebControls: The PageList. When you use Property controls inside the PageList they get their CurrentPage object from the current context - in the standard setup the child pages:
<EPiServer:PageList runat="server" PageLink="3">
<ItemTemplate>
<EPiServer:Property runat="server" PropertyName="Image" />
</ItemTemplate>
</EPiServer:PageList>
this will render the Image properties from all child pages of page 3.
Here's a great tutorial too: http://www.frederikvig.com/2009/12/introduction-create-an-episerver-site-from-scratch/
Hi,
thanks for the reply.I got the sub pages content in my aspx code, using df.GetDescendents method, and added them in the list of pagadata. Now to get them visible in my page which episerver property i use and how???
You can feed your PageDataCollection to the PageList by setting it's DataSource property from codebehind instead of setting the PageLink property as in earlier post.
Hi,
How to get the pagecontent of one page in another page in Episerver cms 6.