I tried to implement an EditorDescriptor to make Category a required property. But i can't get it to work. I have other required properties which isn't inherited from PageData that uses the RequiredAttribute and those works.
What happens is that when i create a new page which should have category as required property it looks as it should be required
But i can proceed without entering a value. My other propert works fine.
The EditorDescriptor looks like this:
[EditorDescriptorRegistration(TargetType = typeof(CategoryList))]
public class CategoryListEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(
ExtendedMetadata metadata,
IEnumerable attributes)
{
base.ModifyMetadata(metadata, attributes);
if (metadata.PropertyName == "icategorizable_category" && metadata.FindOwnerContent() is IEventPage)
{
metadata.IsRequired = true;
}
}
}
Isn't this the way to do it?
I can get it to work when overriding category in my implemented page type and applying the RequiredAttribute
[Required]
public override CategoryList Category { get; set; }
I noticed that if I remove my EditorDescriptor and only using the override of Category it doesn't work either. It only works when I'm using both the override and the EditorDescriptor together.
Hi!
I tried to implement an EditorDescriptor to make Category a required property. But i can't get it to work. I have other required properties which isn't inherited from PageData that uses the RequiredAttribute and those works.
What happens is that when i create a new page which should have category as required property it looks as it should be required
But i can proceed without entering a value. My other propert works fine.
The EditorDescriptor looks like this:
Isn't this the way to do it?
I can get it to work when overriding category in my implemented page type and applying the RequiredAttribute