Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

[AllowedTypes] of Xhtml field


We added the AllowedTypes attribute to an Xhtml field to limit the different kind of block that are allowed in the mainbody area.

[AllowedTypes(new[] { typeof(LinkBlock), typeof(TextBlock) })]
public virtual XhtmlString MainBody { get; set; }

After that we experienced all kinds of weird behavior. We were not longer able to 'drag n drop' in blocks (not even the allowed types) to the mainbody area. Sometimes the mainbody area was emptied when trying.

Anyone experienced the same thing? Is the AllowedType attribute compatible with XhtmlString?

Oct 29, 2014 10:15

Not working here either, seems that it's not supported.

Jan 07, 2015 9:18

For me it works fine in IE, but it doesn't work so well in Google Chrome.
For example, when using Google Chrome, I have to click on XHTML field first, and only then drag&drop the block.
I don't have to do that in IE.

I also noticed that sometimes drag&drop validation is not triggered, so I have to use custom IValidate<PageData> validator.

Feb 03, 2015 12:10

Yes, misread the question :)
Content doesn't disappear, just the blue border around all input fields in Chrome and FF.

EPiServer 7.19.1

Feb 03, 2015 13:13

There is a discussion about this in the following Blog post:

Feb 04, 2015 14:53
* 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.