Try our conversational search powered by Generative AI!

Filtering PageList


Front-end developer here and trying to achieve something without resorting to the code-behind. I'm using CMS6

I have a PageList control that I'd like to only display pages that meet a specific requirement. So, my content tree looks like this...

Root folder

Page1, Page2, ... each have a "Dynamic list (multiple options)" property called "Flag". When that property is set to "A", I want it to display in the PageList.

Here's what I am trying, but results in a "Object reference not set to an instance of an object."

<EPiServer:SearchDataSource PageLink="5" runat="server" ID="ListDS" >
    <EPiServer:PropertyParameter Name="PageLink" PropertyName="Flag"  />

<EPiServer:PageList SortBy="PageName" DataSource="<%# ListDS %>" runat="server" ID="t1_list">


Is the searchdatasource the right approach? I've searched high and low for examples on how to use it, but the only example is how to use it when the query parameter is coming from an element on the page. I did find an article,, but the page doesn't come up.

thanks in advance

May 04, 2010 17:28

You can set specific parameters for the SearchDataSource. Try something like this:

    <EPiServer:PropertyCriteriaControl Condition="Equal" Name="Flag" Value="A" />

May 04, 2010 22:10

Thanks Per,

Any thoughts as to why I'd be getting the following error message?

Unable to cast object of type 'EPiServer.Web.WebControls.SearchDataSource' to type 'System.Collections.IEnumerable'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast object of type 'EPiServer.Web.WebControls.SearchDataSource' to type 'System.Collections.IEnumerable'.

Edited, May 05, 2010 20:19

You cant use SearchDataSource with a pagelist. Use a repeater instead.

The pagelist datasource expects a control that contains a pagedatacollection and implements the IEnumerable interface.


May 05, 2010 21:50

Can I use <episerver:property> controls from within an asp:repeater?

May 05, 2010 22:06

Yep :)

May 05, 2010 23:47
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.