Try our conversational search powered by Generative AI!

Disable dragging of blocks in XHTML properities


Episerver has the feature to drag blocks in XHTML fields, it automatically creates dynamic content in this property. I want to disable this feature because it creates confusion with users and also can mess up the layout of the page.

How can i disable this feature?

Thanks in advance

Feb 01, 2016 13:08

Hi Ron,

First of all, I have to say that having blocks inside XhtmlString properties is one of the best features ever! Our editors love it! :)

One way to disable this is to create a custom EditorDescriptor:

    TargetType = typeof(XhtmlString),
    EditorDescriptorBehavior = EditorDescriptorBehavior.ExtendBase,
    UIHint = "MyDescriptor")]
public class MyDescriptor : EditorDescriptor
    public MyDescriptor()
        AllowedTypes = new[] { typeof(PageData) };

And decorate your XhtmlString properties like this:

public virtual XhtmlString MyProperty { get; set; }

I'm not sure if blocks inside XhtmlString are officially supported. AllowedTypes attribute used to work with XhtmlString properties, but not anymore.
I've tested the code above with Alloy, EPiServer CMS 9.6.1, and latest version of Google Chrome

Hope this helps!

Feb 01, 2016 14:00

Excellent that looks like a solid solution! Thanks so much!

Feb 01, 2016 14:14
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.