I'm doing a FindPagesWithCriteria, and I have 2 criterias.
The first is a criteria on a selected/not selected, and working just fine.
Then I'm doing a criteria on a global property that is a "Page"
First I made the criteria pagetype a PageReference.
Then a PageData, but still, it's like it's ignoring this criteria.
when I only use the boolean, I get 8 pages. When I use them both I get 33(the whole pagenumber). and by itself also 33.
PropertyCriteria crit1 = new PropertyCriteria();
crit1.Type = PropertyDataType.Boolean;
crit1.Name = "property1";
crit1.Value = true.ToString();
crit1.StringCondition = EPiServer.Filters.StringCompareMethod.Identical;
PropertyCriteriaCollection critColl = new PropertyCriteriaCollection();
critColl.Add(crit1);
PropertyCriteria crit2 = new PropertyCriteria();
crit2.Type = PropertyDataType.PageReference;
crit2.Name = "Property2";
crit2.Value = pageRef.ToString();
crit2.StringCondition = EPiServer.Filters.StringCompareMethod.Identical;
critColl.Add(crit1);
PageDataCollection pages = Global.EPDataFactory.FindPagesWithCriteria(RootPage.PageLink, critColl);
Update.
I've found out that the problem is in the Inherited value of the "Property" global property.
When I do a search it only get's me the page where the Global property is set. Not the child nodes.
I have TEST which is the parent.
and child1, child2, child3 which are the child nodes
which inherits the page property from TEST.
When I do the search, it looks like it only gets TEST, where the page property originally was set.
How do I search in both Parent and Child nodes???
PropertyCriteria crit1 = new PropertyCriteria(); crit1.Type = PropertyDataType.Boolean; crit1.Name = "property1"; crit1.Value = true.ToString(); crit1.StringCondition = EPiServer.Filters.StringCompareMethod.Identical; PropertyCriteriaCollection critColl = new PropertyCriteriaCollection(); critColl.Add(crit1); PropertyCriteria crit2 = new PropertyCriteria(); crit2.Type = PropertyDataType.PageReference; crit2.Name = "Property2"; crit2.Value = pageRef.ToString(); crit2.StringCondition = EPiServer.Filters.StringCompareMethod.Identical; critColl.Add(crit1); PageDataCollection pages = Global.EPDataFactory.FindPagesWithCriteria(RootPage.PageLink, critColl);