You can set specific parameters for the SearchDataSource. Try something like this:
<EPiServer:SearchDataSource>
<Criteria>
<EPiServer:PropertyCriteriaControl Condition="Equal" Name="Flag" Value="A" />
</Criteria>
</EPiServer:SearchDataSource
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'.
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.
/Per
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
Home
Top
Page1
Page2
Page3
etc
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" >
<SelectParameters>
<EPiServer:PropertyParameter Name="PageLink" PropertyName="Flag" />
</SelectParameters>
</EPiServer:SearchDataSource>
<EPiServer:PageList SortBy="PageName" DataSource="<%# ListDS %>" runat="server" ID="t1_list">
<ItemTemplate>
...
</ItemTemplate>
</EPiServer:PageList>
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, http://tednyberg.com/post/Search-for-EPiServer-pages-based-on-properties.aspx, but the page doesn't come up.
thanks in advance