Advanced property search in the complete database.
Namespace:
EPiServer.WebControlsAssembly: EPiServer.Legacy4 (in EPiServer.Legacy4.dll) Version: 6.1.379.0
Syntax
| C# |
|---|
[ObsoleteAttribute("Use SearchDataSource in combination with a DataBoundControl or a HierarchicalDataBoundControl", false)] public class PropertySearch : PageControlBase |
Remarks
PropertySearch does not have any templated gui, it only delivers data from the database. A complete database search will be performed using specified property criterias.
Performance tip! Try to setup as few criterias as possible for your selection because every critera will resolve into a database lookup.
If you add more the one criteria they will logically be treated as OR, you may override this by setting Required. See PropertyCriteria for information about available criteria settings.
Examples
Example of how to do a search for pages in the database, in this example that have
a property with name "DisplayOnFirstPage" of type Boolean and is set to "True". A PageList
is used to display the data.
Copy
The following code example demonstrates how to find all page types that have a certain page type.
CopyC#
<episerver:PropertySearch PageLink="<%#EPiServer.Core.PageReference.StartPage%>" runat="server" ID="PropertySearch1">
<episerver:propertycriteria Name="DisplayOnFirstPage" Value="True" Type="Boolean"/>
</episerver:PropertySearch>
<episerver:PageList SortBy="PageName" DataSource="<%#PropertySearch1%>" runat="server" ID="PageList1">
<ItemTemplate>
<episerver:property PropertyName="PageName" runat="server"/>
<br/>
</ItemTemplate>
</episerver:PageList>int searchPageTypeID = 10; PropertyCriteriaCollection criterias = new PropertyCriteriaCollection(); PropertyCriteria criteria = new PropertyCriteria(); criteria.Name = "PageTypeID"; criteria.Type = PropertyDataType.PageType; criteria.Condition = CompareCondition.Equal; criteria.Value = searchPageTypeID.ToString(); criterias.Add(criteria); PageDataCollection pages = EPiServer.DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage, criterias); foreach (PageData page in pages) { Response.Write(String.Format("Found page: {0} - {1} ({2})", page.PageLink.ID, page.PageName, page.PageTypeName)); }
Inheritance Hierarchy
System..::.Object
System.Web.UI..::.Control
EPiServer.Web.WebControls..::.PageControlBase
EPiServer.WebControls..::.PropertySearch
System.Web.UI..::.Control
EPiServer.Web.WebControls..::.PageControlBase
EPiServer.WebControls..::.PropertySearch