Reputation: 993
I've been scratching my head bald regarding this issue and I am left blank.
I have a PageType, containing a custom property which is directly copied from the AlloyDemo.
[BackingType(typeof(PropertyStringList))]
[Display(Order = 305)]
[UIHint(Global.SiteUIHints.Strings)]
[CultureSpecific]
public virtual string[] Address { get; set; }
The BackingType PropertyStringList class looks like this:
[EditorHint(Global.SiteUIHints.Strings)]
[PropertyDefinitionTypePlugIn(Description = "String List",
DisplayName = "String List")]
public class PropertyStringList : PropertyLongString
{
protected String Separator = "\n";
public String[] List
{
get
{
return (String[])Value;
}
}
public override Type PropertyValueType
{
get
{
return typeof(String[]);
}
}
public override object SaveData(PropertyDataCollection properties)
{
return LongString;
}
public override object Value
{
get
{
var value = base.Value as string;
if (value == null)
{
return null;
}
return value.Split(Separator.ToCharArray(),
StringSplitOptions.RemoveEmptyEntries);
}
set
{
if (value is String[])
{
var s = String.Join(Separator, value as String[]);
base.Value = s;
}
else
{
base.Value = value;
}
}
}
public override IPropertyControl CreatePropertyControl()
{
//No support for legacy edit mode
return null;
}
}
When I run the site, it renders (in Edit mode) the property Address like this:
Rendering fail, which is a button And when I click the button I get this: Null Reference Exception in a popup
I seriously have no clue why this is happening. Could somebody explain?
Regards, Chris
Upvotes: 0
Views: 795
Reputation: 161
You are missing the editor descriptor. Check out "StringListEditorDescriptor.cs" in the Alloy project. You'll also need the client resources -the StringList dojo script. And you also need to register this module.config
Upvotes: 2