Episerver在编辑模式下自定义网格中的复杂数据类型
我目前正在研究episerver 9厘米。
我有我的页面/块如下:
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; }
}
现在在CMS中,编辑模式下,它呈现为
如你所见,Dishes被渲染为[object object]而不是dishName。
任何人都可以告诉我如何实现这一目标?
谢谢。
您可以创建自己的继承CollectionEditor
的Dojo小部件,并自定义项目的呈现方式。
然后,您可以使用适用的PropertyList
属性的EditorDescriptor
属性指定自定义编辑器。
Hi @TedNyberg - 您对PropertyList的开发有任何洞见,并且他们是否打算使自定义方式呈现属性而不用去做道场 ? 一个简单的集合 - ToString-thingy-UIHint:ish会很好......;)
链接地址: http://www.djcxy.com/p/68881.html上一篇: Episerver customise complex data type in grid in edit mode