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

CollectionEditorDescriptor - How to display a list of complex types?

$
0
0

Hi Guys,

First off apologies if this has already been posted.

That aside, Now for my issue....

I have the following class structure:

public class MenuItem

{

public virtual LinkItemCollection Links { get; set; }

}

public class MenuSubCategory

{

public virtual string SubCategoryTitle { get; set; }

[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor))]
public virtual IList MenuItems { get; set; }

}

public class MenuCategory

{

public virtual string CategoryTitle { get; set; }

[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor))]
public virtual IList MenuSubCategories { get; set; }

}

In addition to this I also have a number of PropertyDefinitionTypePlugIns defined which look similar to this:

[PropertyDefinitionTypePlugIn]
public class MenuCategoriesProperty : PropertyList

{

protected override MenuCategory ParseItem(string value)

{

return JsonConvert.DeserializeObject(value);

}

public override PropertyData ParseToObject(string value)

{

ParseToSelf(value);
return this;

}

}

And finally I have added the flowwing property to my Block:

[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor))]
public virtual IList MenuCategories { get; set; }

Now, when I attempt to edit the above itall works fine.  The issue I have is that episerver doesn't seem to know how to render my complex type so in edit mode, when I add a new Menu Categor, I see the following:

Cards    [object Object], object Object]

What I would like it to display is:

Cards     Birthday, Thank You, Well Done....

All that explained my question is, how would I go about making the above dislpay correctly?

Thanks in advance!


Viewing all articles
Browse latest Browse all 9076

Trending Articles