Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
PropertyCriteriaCollection criterias = new PropertyCriteriaCollection();
PropertyCriteria critPageType = new PropertyCriteria();
critPageType.Name = "PageTypeName";
critPageType.Type = PropertyDataType.String;
critPageType.Condition = CompareCondition.Equal;
critPageType.Value = "News";
criterias.Add(critPageType);
PropertyCriteria critCategory = new PropertyCriteria();
CategoryList _categoryList = ((PropertyCategory)(CurrentPage.Property["PageCategory"])).Category;
critCategory.Name = "PageCategory";
critCategory.Type = PropertyDataType.Category;
critCategory.Condition = CompareCondition.Equal;
critCategory.Value = _categoryList.ToString();
critCategory.Required = true;
criterias.Add(critCategory);
PageDataCollection countries = Global.EPDataFactory.FindPagesWithCriteria((PageReference)CurrentPage.Property["ListBoxD"].Value, criterias);
NewsShortListControl.DataSource = countries;
try
{
NewsShortListControl.DataBind();
}
catch (NullReferenceException)
{
}
The following code example demonstrates the usage of FindPagesWithCriteria to search categories. // Make sure the pagetype has a property called // CategoryListing of type Category. This property // is used by the editor to specify which categories // to search for. string categories = CurrentPage.Property["CategoryListing"].Value.ToString(); PropertyCriteria criteria = new PropertyCriteria(); criteria.Type = PropertyDataType.Category; criteria.Name = "PageCategory"; criteria.Value = categories; criteria.Condition = EPiServer.Filters.CompareCondition.Equal; PropertyCriteriaCollection col = new PropertyCriteriaCollection(); col.Add(criteria); PageDataCollection pages; pages = Global.EPDataFactory.FindPagesWithCriteria(Global.EPConfig.StartPage, col);
Thanks. Victor