EPiServer 4.61 with ASP.Net 2.0
I've successfully made an asp:Repeater with datasource made with following code:
PropertyCriteria criteria = new PropertyCriteria(); criteria.Type = PropertyDataType.Category; criteria.Name = "PageCategory"; criteria.Value = categories; //string with category name criteria.Condition = EPiServer.Filters.CompareCondition.Equal;
PropertyCriteriaCollection col = new PropertyCriteriaCollection(); col.Add(criteria);
children = Global.EPDataFactory.FindPagesWithCriteria(sideContainer, col);
This is working perfectly. However when we change template file (.aspx) of a pagetype it fails. My case is with Ordinary Web page:
The error occured after followin sequence:
1. I created couple of Categories for purpose of filtering pages by category later on
2. I than published some Ordinary Pages and marked them with a certain category.
3. At this point I converted Ordinary Page, XForm, and News by linking them with my newly created Standardpage.aspx. This was done so that already published pages would have same possibilities as Standard page without need of republish.
4. I then copied all of the page properties between the converted page types and added couple of others used by Standard page.
5. One of the newly added properties is a Page link that uses FindPagesWithCriteria to list out all of the pages with certain criteria (here category) under a specified page.
It's at bullet 5 that averything goes wrong. EPiServer returnes 0 pages when filtering on the categories created under bullet 1.
It seems that some kind of "weird" logic behind the curtain no longer aknowledges categories prior to conversion under bullet 3. A workaround is to delete and then create all of the categories prior to conversion.