Hi,
In My project I have added mutiselect country check box list using PropertyList. Code is below
[Display(Name = ........................)] [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor))] [Editable(true)] public virtual IList VisibleFor { get; set;
}
public class PropertyListBase : PropertyList {
public PropertyListBase() {
_objectSerializer = this._objectSerializerFactory.Service.GetSerializer("application/json"); } private Injected _objectSerializerFactory; private IObjectSerializer _objectSerializer; protected override T ParseItem(string value) { return _objectSerializer.Deserialize(value); } public override PropertyData ParseToObject(string value) { ParseToSelf(value); return this; } }
public class Country { [CultureSpecific] [Display(Name = "Country", GroupName = SystemTabNames.PageHeader, Order = 30)] [SelectMany(SelectionFactoryType = typeof(CountrySelectionFactory))]
public virtual string CountryName { get; set; }
} [PropertyDefinitionTypePlugIn] public class ContactListProperty : PropertyListBase { }
But the problem is , here users are allowed to select the same country more than once, by clicking the Add button mutiple times. How to avoid the same.
Thanks in advance.
//Tanmoy
Hello Tonmoy
You should be able to create a IValidator to achieve this. It can validate your model.
http://www.david-tec.com/2012/06/EPiServer-7-Preview---IValidator-interface/
David
Hi,
In My project I have added mutiselect country check box list using PropertyList. Code is below
[Display(Name = ........................)]))] VisibleFor
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor
[Editable(true)]
public virtual IList
{
get; set;
}
public class PropertyListBase : PropertyList
{
public PropertyListBase()
{
_objectSerializer = this._objectSerializerFactory.Service.GetSerializer("application/json"); _objectSerializerFactory;(value);
}
private Injected
private IObjectSerializer _objectSerializer;
protected override T ParseItem(string value)
{
return _objectSerializer.Deserialize
}
public override PropertyData ParseToObject(string value)
{
ParseToSelf(value);
return this;
}
}
public class Country
{
[CultureSpecific]
[Display(Name = "Country", GroupName = SystemTabNames.PageHeader, Order = 30)]
[SelectMany(SelectionFactoryType = typeof(CountrySelectionFactory))]
public virtual string CountryName { get; set; }
}
[PropertyDefinitionTypePlugIn]
public class ContactListProperty : PropertyListBase
{
}
But the problem is , here users are allowed to select the same country more than once, by clicking the Add button mutiple times. How to avoid the same.
Thanks in advance.
//Tanmoy