Just Code‎ > ‎

C# EPiServer - Get Filtered PageDataCollection from codebehind

posted Feb 14, 2010, 3:54 AM by Peter Henell

protected EPiServer.Core.PageDataCollection getAdsWithFilter(string categoryNameFilter)
        {
            EPiServer.PropertyCriteriaCollection uthyresCriteriaCollection = new EPiServer.PropertyCriteriaCollection();
            EPiServer.PropertyCriteria uthyresCriteria = new EPiServer.PropertyCriteria();

            uthyresCriteria.Condition = EPiServer.Filters.CompareCondition.Equal;
            uthyresCriteria.Type = EPiServer.Core.PropertyDataType.String;
            uthyresCriteria.Name = "Category";
            uthyresCriteria.Value = categoryNameFilter;
            uthyresCriteria.Required = true;
            uthyresCriteriaCollection.Add(uthyresCriteria);

            return EPiServer.Global.EPDataFactory.FindPagesWithCriteria(CurrentPage.ParentLink, uthyresCriteriaCollection);
        }
Comments