Login

How do I list pages from multiple sources?

Versions: n/a, FAQ number: 97, Old FAQ number: 941

Q: How do I list pages from multiple sources?

A: Simply chain web controls using the DataSource property and fetch new lists of pages with the PageLink property on each chained control. The pages received using the DataSource and PageLink properties on a control are automatically combined into a new list that can be passed to the next control in the chain, and so on.

Here is an example with 3 chained controls; PageSource1 fetches pages from a PageReference property called "OtherPages1", PageSource2 imports the results from PageSource1 and also gets a new list of pages from a PageReference property called "OtherPages2".  The ResultsList control gets the list from PageSource2, fetches some more pages using its CurrentPageLink property (it gets all the children to the current page), sorts the complete list by PageName and finally displays the pagelink of each listed page.

<EPiServer:PageList id="PageSource1" 
        PageLink='<%#CurrentPage["OtherPages1"]%>'  runat="server"/>

<EPiServer:PageList id="PageSource2" DataSource='<%#PageSource1%>'
        PageLink='<%#CurrentPage["OtherPages2"]%>'  runat="server" />

<EPiServer:PageList id="ResultsList" DataSource='<%#PageSource2%>'
       PageLink='<%#CurrentPageLink%>' runat="server" SortBy="PageName">
 <ItemTemplate>
    <EPiServer:Property PropertyName="PageLink" runat="server"/><br/>
 </ItemTemplate>
</EPiServer:PageList>

Note: the properties OtherPages1 and OtherPages2 can be either properties on the current page or dynamic properties.
EPiTrace logger