Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

IList as a field in a Block

$
0
0

Hi All,

Very recently I came to know that I could have IList as a field in a Block. Following is the field I have added.

[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<MenuSectionBlock>))]
        [Display(
            Name = "Section",
            Description = "Add sections here",
            GroupName = SystemTabNames.Content,
            Order = 6)]
        public virtual IList<MenuSectionBlock> Sections { get; set; }
        [PropertyDefinitionTypePlugIn]
        public class DishPropery : PropertyList<MenuSectionBlock>
        {
            protected override MenuSectionBlock ParseItem(string value)
            {
                return JsonConvert.DeserializeObject<MenuSectionBlock>(value);
            }
            public override PropertyData ParseToObject(string value)
            {
                ParseToSelf(value);
                return this;
            }
        }

With this implementation I am now able to add data but am not able to view the same in Preview/Edit mode unless I publish the block. Is the code missing something?


Viewing all articles
Browse latest Browse all 9076

Trending Articles