Episerver customise complex data type in grid in edit mode

Im currently working on episerver 9 cms.

I have my pages/blocks as follows:

    public class  MenuBlock : SiteBlockData
    {

        [Display(
            Name = "Menu title",
            Description = "* Required",
            GroupName = SystemTabNames.Content,
            Order = 1)]
        public virtual string MenuTitle { get; set; }


        [Display(
          Name = "Section",
          Description = "Add menu sections",
          GroupName = SystemTabNames.Content,
          Order = 3)]
        [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<SectionBlock>))]
        public virtual IList<SectionBlock> Section { get; set; }

  }

public class SectionBlock
    {
        [Display(
            Name = "Section name",
            Description = "Select the Menu Image",
            GroupName = SystemTabNames.Content,
            Order = 1)]
        public virtual string SectionName { get; set; }

        [Display(
          Name = "Dishes",
          Description = "Dishes",
          GroupName = SystemTabNames.Content,
          Order = 2)]
        [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<DishBlock>))]
        public virtual IList<DishBlock> Dishes { get; set; }
    }

public class DishBlock
    {
        [Required(ErrorMessage = "Dish name is required")]
        [Display(Name = "Dish name",
            Description = "* Required",
            GroupName = SystemTabNames.Content,
            Order = 1)]
        public virtual string DishName { get; set; }

        [Display(
            Name = "Dish description",
            Description = "",
            GroupName = SystemTabNames.Content,
            Order = 2)]
        [UIHint(UIHint.Textarea)]
        public virtual string DishDescription { get; set; }

        [Display(
            Name = "Price",
            Description = "",
            GroupName = SystemTabNames.Content,
            Order = 4)]

        public virtual double Price { get; set; }

    }

Now In CMS, edit mode, it is rendered as 在这里输入图像描述

As you can see, Dishes are rendered as [object object] instead of dishName.

Can anyone suggest me how to achieve this ?

Thanks.


You could create your own Dojo widget inheriting CollectionEditor and customize how the items are rendered.

You'd then specify your custom editor using the EditorDescriptor attribute for the applicable PropertyList properties.


Hi @TedNyberg — do you have any insight in the development of PropertyList and if they intend to make it possible to render the attributes in a custom way without going the dojo -way? A simple collection-ToString-thingy-UIHint:ish would be nice... ;)

链接地址: http://www.djcxy.com/p/68882.html

上一篇: 滑动菜单J. Feinstein的实现

下一篇: Episerver在编辑模式下自定义网格中的复杂数据类型