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

Composer ExtensionContentArea renders empty DIV

Vote:
 

Hi,


In our Composer Layout blocks we've noticed that Extension:ExtensionContentArea renders an empty DIV as its end-tag:

<!-- Start Composer Layout block -->

<!-- Start Composer Content block -->

Content goes here

<!-- End Composer Content block -->

<div> </div>

<!-- End Composer Layout block -->

 

Has anyone else experienced this, and if so, how can it be avoided?

 

//Marcus

#59107
May 22, 2012 8:52
Vote:
 

Hi Marcus,

I've also experienced this but I'm sorry to say that i don't know any solution for it. I am also looking for a solution so if you managed to find anything let me know.

#60205
Jul 25, 2012 14:58
Vote:
 

Hi Thomas,

The solution we came up with (or rather "quick-fix") was to use jQuery to remove the empty DIV-tag.

#60247
Jul 30, 2012 9:02
Vote:
 

Hmmm, using javascript doesn't really cut it for me. Tried to solve it using inheritance and overrides on the render methods but without success. Anybody found a solution yet?

#61627
Sep 25, 2012 16:41
Vote:
 

Hi, I realise this thread is very old, but did anyone ever find a solution or workaround (non-Javascript based) to resolve this?

#90447
Sep 10, 2014 2:58
Vote:
 

I think I've found both the solution and the cause...

It's possibly being caused by the holder panel in the ExtensionContentArea control rendering when in non-edit mode. This could be resolved by EPiServer using a PlaceHolder instead of a Panel.

To fix it, you can attach the following pre-render handler to your ExtensionContentArea's which will hide the holder panel in non-edit mode.

        private static Lazy HolderGetter = new Lazy(() =>
        {
            var type = typeof(ExtensionContentArea);
            var field = type.GetMember("_holder", MemberTypes.Field, BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault() as FieldInfo;
            return field;
        });

        internal static void ExtensionArea_PreRender(object sender, EventArgs e)
        {
            var extensionArea = sender as ExtensionContentArea;
            if (extensionArea != null && HolderGetter.Value != null)
            {
                var holder = HolderGetter.Value.GetValue(extensionArea) as Control;
                if (holder != null && extensionArea.Holder != holder)
                {
                    holder.Visible = false;
                }
            }
        }

If you're particularly tricky, you may be able to attach it to your page's ExtensionPageHandler's LoadContentArea event to make sure you get your pre-render handler onto them all...

#90451
Edited, Sep 10, 2014 9:02
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.