Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi,
This is the code for the page type criteria.
If you want to get the id of a specific page type and only have the page type class, you can work with the PageTypeRepository - ServiceLocator.Current.GetInstance<PageTypeRepository>()
PropertyCriteria criteria = new PropertyCriteria();
criteria.Condition = CompareCondition.Equal;
criteria.Name = "PageTypeID";
criteria.Type = PropertyDataType.PageType;
criteria.Value = idOfPageType;
criteria.Required = true;
Also add your other criteria based on what kind of value you have on the property.
There are some good get-started blog posts about FindPagesWithCriteria:
http://www.frederikvig.com/2009/10/episerver-findpageswithcriteria-and-findallpageswithcriteria/
http://tedgustaf.com/blog/2010/5/search-episerver-pages-using-findpageswithcriteria/
Note!
Remember to cache your result since FindPagesWithCriteria makes a request directly to the database.
Hello,
I'd like to get all the pages of a specific pagetype and filter them based on a property value. I'm guessing that I have to use the FindPagesWithCriteria method, but im not sure how to properly request all the pages of a specific type, and then filter that via LINQ on a specific property value of my choosing.
Any help is much apprechiated!
Thanks.