Views: 8807
Number of votes: 4
Average rating:

Itera.Objects, a extension for PageTypeBuilder

I have been looking and PageTypeBuilder, and the concept is great. But one thing I missed was the ability to add objects of all types and not only primitives or propertydata types.

I started by downloading the latest build, and looked around. The Interceptor get’s the value of a property and set’s it on the page object. I therefore had to create a property that was a wrapper around a object.  Before I have used Itera.MultiProperty to store many variables. This time I tried to use the dynamic data store, but after a couple of hours trying to set a setting on a property from code I switch over to saving them as real properties on the page.

These properties are disabled from edit mode, and I have a container property that shows these hidden properties.


When Page type builder finds this stuff It will create a 2 properties. But since PTB doesn’t follow type’s I have made a IInitializableModule that follows these types, and adds the hidden properties.



The property PropertyContainer will in a context of a strong Types page create the an instance of the object and populate all the primitives from the hidden property data. If it encounter another PropertyContainer it will create that object and populate it form it’s hidden properties.


There is actually 5 different properties, that will display a bit differently in edit mode.

  1. PropertyContainer
  2. PropertyContainerWithHelp
  3. PropertyContainerSmall
  4. PropertyContainerSmallNoBox
  5. PropertyContainerSmallWithHelp

If you specify different tab’s for the different properties the layout will also change.


will display in edit mode like this:




How cool is that :)

And even better, the tabs have access rights!

Code is available here

    (By Johan Petersson , 21 September 2010 10:33, Permanent link)

    Very cool!

    (By Erik Nordin Wahlberg , 21 September 2010 10:33, Permanent link)

    Wow, this is really cool! To bad you did't find a way for using settings for properties via code. Have you talked with EPiServer about it?

    (By Guest , 21 September 2010 10:33, Permanent link)

    I sent a mail to Mr Smith :), but haven't got a replay. The logical step would to bind what kind of type the property should be as an value on the property setting. Instead I needed to find the PageType when you access the Value and find by reflection the type.
    It could also be possible to save the inner values inside these property settings, but as it turned out there are a few benifitts of saveing them as real properties. Copy, Export and so on....
    / Anders Hattestad

    (By Guest , 21 September 2010 10:33, Permanent link)

    Seems like a good way to structure your pages into reusable components. Very cool!
    / Patrik Akselsson

    (By Mark Everard , 21 September 2010 10:33, Permanent link)

    Wow, what a great idea and implementation.

    This is, from a code perspective rather than a persistence perspective, really beginning to stretch the EPiServer model beyond simple dictionary based PropertyBags.

    Probably a big ask, but is there any way to go further and allow strongly typed access to List and Collection types. This will obviously present difficulties unless those collections were serializable, but that functionality would really be valuable.

    (By Guest , 21 September 2010 10:33, Permanent link)

    There is a couple of ways of doing lists.
    1) Itera.MultiProperty do save all sub properties as a string. The only issue is that we need a way populating the PageData object with it's value.
    2) make a generic PropertyAnyClass class that use the ObjectDataStore. I have actully most of the implementasion ready, will post it as soon I can.

    If any of you have managed to set a property setting on property from code, please let me know.
    / Anders Hattestad

    (By Guest , 21 September 2010 10:33, Permanent link)

    What email? I haven't seen anything from you Anders.
    / Paul Smith

    (By Guest , 21 September 2010 10:33, Permanent link)

    Guess it got cought in the crazy laughing programmer mail filter rule you have:)

    was basicly a question about some example code for setting a property setting when all you had was the propertie def id

    will resend
    / Anders Hattestad

    (By Guest , 21 September 2010 10:33, Permanent link)

    My bad.
    Had an error in paul smith's epost adress , so you can stop searching your email server :)
    / Anders Hattestad

    (By Joel Abrahamsson , 21 September 2010 10:33, Permanent link)

    Really interesting stuff! Will take a closer look at it as soon as I can. I'm also very interested in your question to Paul, so perhaps you, Paul, could post your reply as a blog post?

    (By Joel Abrahamsson , 21 September 2010 10:33, Permanent link)

    Oh and I'd also love to hear more about your experiences of building on top of/plugging into Page Type Builder!

    (By Guest , 21 September 2010 10:33, Permanent link)

    Got an answar to how we should set properties on properties by code.
    setting is the propertysetting class.

    object setting=Activator.CreateInstance(EPiPropertySetting.PropertySettingType, EPiPropertySetting.PropertySettingArgument);
    if (realProperty.SettingsID == Guid.Empty)
    realProperty.SettingsID = Guid.NewGuid();
    var settingsContainer = new PropertySettingsContainer(realProperty.SettingsID);

    settingsContainer.AddSettings(new PropertySettingsWrapper
    PropertySettings = setting as IPropertySettings,
    DisplayName = EPiPropertySetting.PropertySettingType.Name,
    IsGlobal = false,
    IsDefault = false

    new PropertySettingsRepository().Save(settingsContainer);
    / Anders Hattestad

    (By Erik Nordin Wahlberg , 21 September 2010 10:33, Permanent link)

    Anders! I removed a property from code, and now it crashes on startup.

    Line 221: return (this.ClassAttribute.EditCaption == null ? Name : (this.ClassAttribute.EditCaption+"["+this.Name+"]")) + " (is " + this.ClassPropertyType.Name + " render as " + EPiPropertyType.Name + ")";
    in PropertyInfoAndData.cs returns a null reference.

    (By Erik Nordin Wahlberg , 21 September 2010 10:33, Permanent link)

    Sorry, that was not the issue.

    I added a new property of the type int, but i did not declare a Type=typeof(PropertyNumber) when doing that. It caused a null reference to EPiPropertyType.

    (By Lee Crowe , 20 October 2011 13:43, Permanent link)

    Hi Bjorn

    When PageTypeBuilder 2 is officially released I will release a new version of PageTypeBuilderUI. This will contain functionality similar to what Anders has done with his Itera.Objects project to lay the property group properties out in a nicer format.


  Please login to post a comment