Stefan Goßner

Senior Escalation Engineer for SharePoint (WSS, SPS, MOSS, SP2010) and MCMS

Blogs

Solution to allow property editing when being in authoring mode

  • Comments 11
  • Likes

A common question I received from customers is that they would like to edit property values during authoring time similar to editing placeholder content.

I have previously provided a solution for this but this needs to do some coding for every property. A better solution would be to have a server control similar to the MCMS placeholder controls to do this.

After spending a several hours I just finished such a server control which will be available on GotDotNet in a few days.

Here are some screenshots to give you an idea about how this control can be used.

The first picture shows a template loaded in VS.NET that contains several instances of this server control to all the author to modify some properties. As you can see the control allows to edit as well custom properties and standard page properties like the Description property.

Usage is very simple: In the property window you will find 3 properties:

  • PropertyToBind
    This property allows you to pic one of the standard properties like Description, IsImportant, StartDate... from a drop downlist. To allow editing of a custom property it is required to pic the entry "CustomProperty" from the list.
  • CustomPropertyName
    This property will only be used if PropertyToBind has been set to "CustomProperty". In this situation the value in this field needs to be the name of a custom property as given in the Custom Property Definition Collection Editor in the MCMS template explorer.
  • CustomPropertyEditor
    For the standard properties the server control will automatically pick the correct authoring controls: A calendar picker for StartDate, a textbox for Description, ...
    For custom properties the use of the field is not defined by a given schema and the user has to choose which type of editor he would like to use. The only exception are custom properties of type SelectionCustomPropertyDefinition. This type already contains all possible values and these values are populated into a drop down box.
   

During authoring time this will look as follows:

And here is a picture of the Calendar Picker control:

The server control allows to control whether the property value should also be shown in presentation mode or not. If yes, the current version just shows the value in clear text as seen here:

Design Limitation: AuthoringPreview will not show updated values as there is no in-memory save feature as with the placeholder objects. I did not find a quick solution to overcome this limitation.

The sample code is now live on GotDotNet.

Comments
  • Stefan,

    I added the PropertyAuthoringServerControl.cs file to our custom controls and addes it to the toolbox.
    But when I drag this control it give me error saying error creating control.
    It would be nice if you can provide step by step instructions.

    Regards,
    Randall

  • Hi Stefan,

    Great control. Nice work.

    One possible enhancement: render a label for the input fields. Now I had to add some extra logic to avoid that the my labels ('name', 'displayname', names of the cust props., ...) are shown in presentation mode.

    Greetings, Steven

  • Hi Steven,

    yes, that is a good idea.
    Feel free to add it by yourself!

    Cheers,
    Stefan.

  • As an author for an MCMS web site you might have experienced the problem that you first have to save...

  • My control to allow direct editing of property values during edit time contained a small bug in the time...

Raw Html Fix