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

Try our conversational search powered by Generative AI!

Render block in Xhtml-field


I have a pretty plain block, with image, link and text. I have tried to drag n drop it to a xhtml field, but all it renders are the block name.


The block works fine in a content area. 

Aug 27, 2014 15:10

What does the source look like in TinyMCE while in edit mode? It should look something like this where the block is inserted:

The important part here is the data-classid and data-contentlink attribute. The block cannot be found if those are missing.

The rendering of the block does not work either if you have the focus inside TinyMCE.

Aug 27, 2014 20:18

And by the way, how are you rendering the xhtml property in the template/view? And which base class do you inherit from in your block renderer?

Edited, Aug 27, 2014 20:19

The source inside the timy mce editor looks like this:

I render the xhtml property like this:


And I inherit from the BlockControlBase in my block renderer. I also got the tag "MainBodyStandard" on mu block.

Aug 28, 2014 9:22

This is what causing the problem:

EPiServer.Core.PropertyDataCollection.GetHandler = new GetPropertyDelegate(EPiServer.EmailPropertyGetHandler.EmailPropertyHandler);

The EmailPropertyHandler converts mailto inks to links to contact forms. Unfortunatly it also strips the data-contentlink and the data-classid from the:

Is it possible that the GetPropertyDelegate cant hadle the data-tags?

Sep 01, 2014 17:21


What is EmailPropertyHandler? Is that a third party plugin?

Sep 01, 2014 18:45

No, its a custom written method that converts email andresses in mainbody into adresses to contact form.

 public static PropertyData EmailPropertyHandler(string name, PropertyDataCollection properties)
            if (name.Equals("MainBody")
PropertyData property = properties.Get(name);


Already on the last line there the data-classid and the data-contentlink attributes for the block is gone.

I think it is the same when I use the DefaultPropertyHandler (from EPiServer.Core.PropertyGetHandler).

Sep 02, 2014 9:31

Hi, we have the same problem when trying to modify the mainbody on the publishing event.

public virtual void OnPublishing(PageEventArgs ea)
    var mainBody = ea.Page.Property["MainBody"].Value;
    // Here is data-classid and data-contentlink gone

We are using Slimresponse and we modify the image tags in the MainBody to achieve responsive images.

This seems to break the block rendering in Xhtml.

Sep 02, 2014 9:42

Has anyone found a solution to this problem?

Sep 16, 2014 9:13

If you cast the property to a XhtmlString and then use the method .ToInternalString() it seems like you get what you are looking for.

Edit: You may need to cast the property to an XhtmlStringProperty and then the value to a XhtmlString.

Edited, Sep 16, 2014 10:43

Thank you Erik!

.ToInternalString() worked!!! :-)

Sep 16, 2014 10:57
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.