Extending PropertyContentAreaControl

Kev Rowe
Member since: 2013
 

In an attempt to create a Razor-supporting version of the Drag and Drop Bootstrap page editing displayed on the Alloy site, I have created an implementation of PropertyContentAreaControl as follows:

public class ApetitoPropertyContentAreaControl : PropertyContentAreaControl
    {
        public override void CreateDefaultControls()
        {
            CreateContentAreaControls(false);
        }

        public override void CreateOnPageEditControls()
        {
            CreateContentAreaControls(PropertyIsEditableForCurrentLanguage());
        }

        private void CreateContentAreaControls(bool editMode)
        {
            // Do stuff
        }
    }

I have registered it using the ClassFactoryInitiliazation and selected it as the Presentation Control on my Page's ContentArea property. 

While CreateDefaultControls() is hit when rendering a preview of a Block in edit mode, neither CreateDefaultControls() nor CreateOnPageEditControls() are hit when the page is rendered in normal or edit mode.

I'm sure I'm missing something quite simple, an attachment of the class to the page/blocks in question but I can't find anything in the Alloy site to point me in the right direction.

Both my page and blocks inherit from Site* classes that I've pulled from the Alloy site.

 
#65151 Jan 22, 2013 13:53
  • Linus Ekström
    Member since: 2002
     

    Hi!

    Given that you mention a Razor-based template I suspect that you are using MVC. A web forms based web control, like the one you show, will never be loaded if the main template is MVC-based. You have to create a partial view instead to render your property if the main template is based on MVC.

    #65170 Jan 22, 2013 15:57
  • Kev Rowe
    Member since: 2013
     

    I'm not sure how it eluded me for so long that this was a Web Forms control, after completely running out of ideas I now know exactly where to go. Thanks!

    #65171 Jan 22, 2013 16:07
  • Kev Rowe
    Member since: 2013
     

    Out of interest, we are looking to recreate the ability to drop in floated blocks and dynamically resize them as they're added, are there any working examples of this as with the Alloy Web Forms site?

    #65179 Jan 22, 2013 16:36
  • Linus Ekström
    Member since: 2002
     

    I think that there's an example in the MVC-template package that was just released:

    http://world.episerver.com/Download/Items/EPiServer-CMS/EPiServer-7---CMS/EPiServer-7-MVC-Templates/

    #65184 Jan 22, 2013 17:32
  • Antti Alasvuo
    Member since: 2010
     

    Linus, that link to MVC templates currently gives access denied (at least to me ;-) ).

    #65198 Jan 23, 2013 8:42
  • Linus Ekström
    Member since: 2002
     

    It seems it will be publicly released later today so please have a look in a few hours.

    #65201 Jan 23, 2013 9:41