Try our conversational search powered by Generative AI!

customise complex data type in grid in edit mode

Vote:
 

Hello Guys,

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))]
        public virtual IList 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))]
        public virtual IList 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, my prob is that In Cms edit mode , it is rendered as follows

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

Can anyone suggest me how to achieve this ?

Thanks.





#154813
Edited, Aug 30, 2016 13:32
Vote:
 

What is T of your IList properties?

See this blog post for example

#154873
Aug 31, 2016 21:31
Vote:
 

  It is 
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<SectionBlock>))]
        public virtual IList Section { get; set; }
So T is SectionBlock.

Above,  you can see details for SectionBlock.
#154899
Sep 01, 2016 10:57
Vote:
 

The examples I have seen don't have their own IList property and typically just simpler types in a flat structure. I think that's only what the UI support as well.

#154926
Sep 02, 2016 8:08
* 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.