London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

EditorSelectionEditorDescriptor only works with type string

Vote:
 

I'm having troubles getting the EditorSelectionEditorDescriptor to work with the type int. The reason I want to register my own EditorSelectionEditorDescriptor is because I want to send my own properties to a dijit (widget). I only get the EditorSelectionEditorDescriptor to work correctly when saying the type is string. This is how I have configured the EditorSelectionEditorDescriptor. The constructor is always called but never the ModifyMetadata. I have followed this article -> http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2013/12/Auto-suggest-editor-in-EPiServer-75/

[UIHint("myUIHint")]
public virtual int myProp { get; set; }



[EditorDescriptorRegistration(TargetType = typeof(int), UIHint = "myUIHint")]
public class EditorSelectionEditorDescriptor : EditorDescriptor
{
public EditorSelectionEditorDescriptor()
{
ClientEditingClass = "assambly.editors.myWidget";
}

public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata, IEnumerable attributes)
{
base.ModifyMetadata(metadata, attributes);
metadata.EditorConfiguration["myProp"] = 5;
}
}



Thanks for your help!

#133854
Sep 12, 2015 13:19
Vote:
 

Hi,

I think that I had similar problem. Maybe you should use nullable integer (int?) instead of scalar value.

I mean:

[EditorDescriptorRegistration(TargetType = typeof(int?), UIHint = "myUIHint")]
#133856
Sep 12, 2015 15:07
Vote:
 

Thanks Grzegorz, I don't understand why it works now since int? and int are different and I would never have thought of it myself so thanks again!

#133857
Sep 12, 2015 15:50
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.