I'm not sure there's an editor out of the box for PageReferences, personally I've always just done with a ContentArea restricted down to PageReference types then they can just drag the pages in from the site navigiation tree. However Patrick Van Kleef has another solution here https://www.patrickvankleef.com/2015/02/22/multiple-page-picker-property-in-dojo/
Thanks for the response.
Our reuirement is to display pages names in a check-box list so that user can select the pages.
Okay sorry I didn't read it properly. I've use ILists and SelectMany quite a few times before but usually the IList was connected to an editor descriptor, I'm wondering how the selection factory is being implictly converted to IList<PageReference>. Does it work if you change the type instead to string? Do you get a delimited list of references? If so you could create a propertly to split these and load them in to the PageReference collection.
I am getting a string of all the page reference ids deliminated by ,. So it gives error when it tries to save the selected values.
Since I am new to Episerver development, it would be great help if you could provide the required changes as suggested in earlier post.
Thanks,
Avi
I don't think the IList code has been built to allow saving of page references only string data. I'd suggest the simplest solution is just saving as delimited strings by changing to string and then creating another virtual property returning an IEnumerable<PageReference> by splitting them and loading them via the ContentLoader service.
Hi,
We have a scenario where we need to store multiple page references/content references in a property of a page type.
Here is sample code for the property-
[SelectMany(SelectionFactoryType = typeof(ContactPageSelectionFactory))]
public virtual IList MyContactLink { get; set; }
I have also created a class for property-
[PropertyDefinitionTypePlugIn]
public class PropertyPagesReference : PropertyListBase
{
}
SelectionFactory class -
public class ContactPageSelectionFactory : ISelectionFactory ContentLocator { get; set; }
{
private Injected
public IEnumerable GetSelections(ExtendedMetadata metadata)
{
var contactPages = ContentLocator.Service.GetContactPages();
return new List(contactPages.Select(c => new SelectItem {Value = c.PageLink, Text = c.Name}));
}
}
Above sample code is referring Alloy MVC template.
As SelectMany has Checkbox list in the backend property window which is coming up there but could not save the values.
Thanks,
Avi
Can someone help me in getting this resolved.