ContentArea doesn't show up with a blue square in the on-page-editing mode

Vote:
 

I have made a block with 3 content areas in it, like so:

public class ThreeContentAreas : SiteBlockData
    {
        [Display(Order = 10)]
        public virtual ContentArea Left { get; set; }

        [Display(Order = 20)]
        public virtual ContentArea Middle { get; set; }

        [Display(Order = 30)]
        public virtual ContentArea Right { get; set; }
    }

Then I add it to another page type like this:

        [Display(GroupName = SystemTabNames.Content, Order = 60)]
        public virtual ThreeContentAreas ContentAreas { get; set; }

And then in the view:

            
@Html.PropertyFor(x => x.CurrentPage.ContentAreas.Left)
@Html.PropertyFor(x => x.CurrentPage.ContentAreas.Middle)
@Html.PropertyFor(x => x.CurrentPage.ContentAreas.Right)

I can interact with the content areas as expected in forms editing, but in the on-page-editing they're not interactable as I expected, they just show the content added in the forms editing mode.

There should have been 3 content areas between these 2 other content areas. Doesn't the on-page-editing functionality trigger when the content area is in another block?

#136915
Sep 18, 2015 10:42
Vote:
 

Hi,

You can try to put this code in ~/Views/Shared/DisplayTemplates/ContentArea.cshtml:

@using EPiServer.Web.Mvc.Html
@model ContentArea
@{
    var original = ViewContext.RouteData.Values["currentContent"];
    Html.RenderContentArea(Model);
    if (original != null)
    {
        ViewContext.RouteData.Values["currentContent"] = original;
    }
}

And this code in ~/Views/Shared/DisplayTemplates/ContentData.cshtml:

@model IContentData

@{
    var original = ViewContext.RouteData.Values["currentContent"];
    Html.RenderContentData(Model, false);
    if (original != null)
    {
        ViewContext.RouteData.Values["currentContent"] = original;
    }
}

See http://joelabrahamsson.com/workaround-on-page-editing-broken-after-rendering-a-block/ for more information.

#138441
Sep 22, 2015 10:11
* 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.