Populate SelectionEditor with childpages




I have a page with a PageReference property that has an EditorDescriptor and a custom annotation to make it appear as a drop down list to editors. I got the code from here: http://joelabrahamsson.com/limiting-content-and-page-reference-properties-to-values-of-a-specific-type-in-episerver-cms/.


It works perfectly fine in the cases I want ALL pages of a given pagetype to be in the drop down list, but I have not figured out a way to populate it with only childpages. An example use case is this:


I have a pagetype called ArticleArchive. Each ArticleArchive has children of type ArticlePage. Furthermore, I have a property in the ArticleArchivePage type, that should hold a featured ArticlePage. Here I only want to be able to choose from ArticlePages that are children of the given ArticleArchive, but as it is now, I aslo get to choose pages from other ArticleArchives... 

Anyone god any ideas on this?

Jul 04, 2013 15:22

You need to let your SelectionFactory know where you want to find your children.

I think doing a GetChildren would work better than the ContentSelectionFactory from the blog post you refer to.

See these links for some inspiration




Jul 05, 2013 0:24

Thank you for your reply. I will probably try it if we need it. For now, we acctually decided that we could live with the fact that you could choose articles from another archive, as only one article will show up on our startpage as featured anyways. However, if our client disagrees, I will try what you said and come back to you if it worked or not.

Jul 05, 2013 9:16
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.