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!

On-page Editing for SelectOne and SelectMany Properties

Vote:
 

This is a problem I ran into when client wants more friendly on-page editing experience so that they won't need to switch between the page view and form view.

So I am adding a lot of Razor code such as "

i.PropertyA)> ...
". This works great for the default property types, but I am having trouble use this for the SelectOne or SelectMany properties that I created following the doc: Setting up single or multiple list options.

When I tried to edit thoes fields on page, I didn't get the checkbox list, it was simply rendered as a plain text string (the backing type). Is there a way to use the checkbox list/dropdown from the form view for on-page editing?

#145743
Mar 10, 2016 22:23
Vote:
 

You could do something like this:

[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "FloatingString")]
public class FloatingStringEditorDescriptor : EditorDescriptor
{
    public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
    {
        base.ModifyMetadata(metadata, attributes);
        metadata.CustomEditorSettings["uiWrapperType"] = UiWrapperType.Floating;
    }
}

This will create a floating editor for strings values.

Add a UIHint("FloatingString") to the SelectOne and SelectMany properties in your model.
With on-page editing you will now have a floating editor with a dropdown or checkbox list.

/Mark

#145846
Edited, Mar 14, 2016 11:28
Vote:
 

Thank you very much Mark, and this doesn't look like dark magic at all.

Just wondering, where can I find this kind of resource/documentation, it took me hours searching around.

#145881
Mar 14, 2016 17:23
Vote:
 

Well this one you can find in the Episerver documentation

http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/User-interface/object-editing/Editing-objects/

But mostly it's just searching the blogs an forum (Google is your friend)

#145886
Mar 14, 2016 18:55
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.