Extending PropertyContentAreaControl

Vote:
 

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
Vote:
 

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
Vote:
 

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
Vote:
 

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
Vote:
 

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
Vote:
 

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

#65198
Jan 23, 2013 8:42
Vote:
 

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

#65201
Jan 23, 2013 9:41
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.