Using EditableChildren in N2CMS

138 Views Asked by At

When I using the EditableChildren in N2CMS(ver 2.7.5), in a model page, I getting the error "Cannot add any parts due to zone/user/type restrictions". I have try everything.

See code below:

 [EditableChildren(Title = "Reviews list", ContainerName = CustomTabs.Review)]
        public virtual IList<ReviewItem> ReviewItemsList
        {
            get
            {
                return new ItemList<ReviewItem>(Children);
            }
        }

Any idea?

1

There are 1 best solutions below

0
On

You need to specify the AvailableZone as per https://github.com/n2cms/n2cms/blob/master/src/Mvc/MvcTemplates/Models/Pages/FaqList.cs:

[PageDefinition("FAQ",
    Description = "A list of frequently asked questions with answers.",
    SortOrder = 200,
    IconClass = "fa fa-question-circle")]
[AvailableZone("Questions", "Questions")]
[RestrictParents(typeof (IStructuralPage))]
public class FaqList : ContentPageBase, IStructuralPage
{
    [N2.Details.EditableChildren("Questions", "Questions", 110, ContainerName = Tabs.Content)]
    public virtual IList<Faq> Questions
    {
        get { return GetChildren<Faq>("Questions"); }
    }
}