November Happy Hour will be moved to Thursday December 5th.

Blocks can not be rendered in edit mode

Vote:
 

Hi,

I haven't been able to crack this, so maybe you can help me. I have a simpel page with a content area. I also created a block (I have tried this with a Controller and through IViewTemplateModelRegistrator).

When I added the block to my content area, the block is rendered in the page, but when I try to edit the block the block cannot be rendered by EPiServer and EPiServer switches to the form mode in which I can fill in all my fields.

When I use a controller I'm using a baseclass which looks like this:

[TemplateDescriptor(Inherited = true, TemplateTypeCategory = TemplateTypeCategories.MvcPartialController)]
public abstract class BaseBlockController<T> : BlockController<T> where T : SiteBlockData

When I use the IViewTemplateModelRegistrator it looks like this:

viewTemplateModelRegistrator.Add(typeof(CarouselSlideBlock), new TemplateModel
{
Name = "CarouselSlideBlock",
Inherited = true,
AvailableWithoutTag = true,
Path = String.Format("~/Areas/{0}/Views/Shared/Blocks/CarouselSlideBlock.cshtml", areaName)
});

Does anybody have any idea how I can fix this? It would be great if I could fix this.
Thanks in advance!

#87788
Jun 23, 2014 15:47
Vote:
 

A block is normally rendered as a partial. If you want to edit it on-page you need to render it with a page renderer.

See Rendering-of-content, look for the paragraph about "Preview of block during on page editing"

#87797
Edited, Jun 23, 2014 19:18
Vote:
 

Hi Mark,

Thank you. It was not clear to me that only the PreviewBlockController was enough to render te block correctly.

#87820
Jun 24, 2014 9:47
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.