Get Page Content

Vote:
 

Hi,

How to get the pagecontent of one page in another page in Episerver cms 6.

#45064
Oct 28, 2010 12:31
Vote:
 

Use this, where 999 is the page ID you want to retrieve:

EPiServer.Core.PageData otherPage = this.GetPage(new EPiServer.Core.PageReference(999);
    
#45065
Oct 28, 2010 13:03
Vote:
 

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.

#45066
Oct 28, 2010 14:44
Vote:
 

You can use the following syntax to get access to the individual property values:

otherPage["Ingress"];

otherPage["Image"];

etc

#45069
Oct 28, 2010 16:48
Vote:
 

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...

#45071
Oct 28, 2010 20:51
Vote:
 

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?

#45074
Oct 29, 2010 7:51
Vote:
 

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.

#45075
Oct 29, 2010 8:03
Vote:
 

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.

#45077
Oct 29, 2010 9:37
Vote:
 

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???

#45084
Oct 29, 2010 10:31
Vote:
 

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.

#45112
Oct 29, 2010 17:03
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.