This does not seem the correct definition for list of Emp,
public virtual IEnumerable { get; set; }
try
public virtual IList<Emp> EmpList { get; set; }
I've tried with your suggested option; also tried with List<T>, but no luck.
still am getting the same.
Please help. Thanks
have you register the property definition e.g.
[PropertyDefinitionTypePlugIn]
public class EmpListProperty : PropertyListBase<Emp>
{
}
this is how you will define property in your page type
[EditorDescriptor(EditorDescriptorType = typeof (CollectionEditorDescriptor<Emp>))]
public virtual IList<Emp> EmpList { get; set; }
Thanks a bunch for your qucik response.
Property Definition, I've not registered and I'm not aware of this.
Could you please tell me or share any knowledge base example link. Thanks once again.
this is all that you will require
Define a model
public class Emp
{
public string Name { get; set; }
}
Register Property Definition
[PropertyDefinitionTypePlugIn]
public class EmpListProperty : PropertyList<Emp>
{
}
Add handy editor
[EditorDescriptor(EditorDescriptorType = typeof (CollectionEditorDescriptor<Emp>))]
public virtual IList<Emp> Emps { get; set; }
I've registered the property definition as mentioned below:
using EPiServer.Cms.Shell.UI.ObjectEditing.EditorDescriptors;
using EPiServer.Shell.ObjectEditing;
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<EmpBlockViewModel>))]
public virtual IList<EmpBlockViewModel> EmpDetailsList { get; set; }
Unforturnately, I couldn't resolve the error.
Am looking for, EpiServer Application block: To bind the list of values to the block. Thanks
Is anything related to this actually documented anywhere? I'm trying to do something that should be pretty simple, and I'm now a few hours into it, with no help from documentation.
Am getting below error; while creating the block, pleas see the below details and help me in this regard. Thanks
Error: Type 'System.Collections.Generic.IEnumerable`1[[Project.Web.ViewModels.Blocks.EmpViewModel, Project.Web, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null]]' could not be mapped to a PropertyDefinitionType
---------------------------------------
EmpClass:-
My EmpBlockViewModel below
---------------------------------------
public class Emp
{
public string EmpName { get; set; }
public int EmpNo { get; set; }
public double EmpSal { get; set; }
}
---------------------------------------
EmpDetailsBlock:-
---------------------------------------
[Display(Order = 110, EmpDetailsList { get; set; }
GroupName = SystemTabNames.Content,
Name = "Emp Details list",
Description = "The block will display all the Employess Details.")]
[CultureSpecific]
public virtual IEnumerable
---------------------------------------
EmpDetailsBlockController:-
---------------------------------------
public class EmpDetailsBlockController : EmpBlockController
{
public override ActionResult Index(EmpDetailsBlock currentBlock)
{
currentBlock = new EmpDetailsBlock();
currentBlock.EmpDetailsList = ListofEmployees; // ListofEmployees is added.
return PartialView("~/Views/Blocks/EmpBlock/Index.cshtml", currentBlock);
}
---------------------------------------
EmpBlock View:--
---------------------------------------
@model IEnumerable
@if (Model.EmpDetailsList != null)
{
Emp Details!!!
}
@if (Model.EmpDetailsList != null)
{
@foreach (EmpBlockViewModel d in Model.EmpDetailsList)
{
}
}
---------------------------------------