
Summary
For use in Microsoft Content Management Server, this is a placeholder control that allows authors to edit Posting Custom Properties directly in the page. In authoring mode, Custom Properties are rendered in textboxes or listboxes for users to enter values. In unpublished non-preview mode, Custom Properties are rendered in text values. In published or preview mode, nothing will be rendered.
Both C# and VB.NET versions are included.
Description
Although this is built as a placeholder control, nothing is actually saved to the placeholder. I started out developing this as a plain web control but could not find a suitable event to save the Custom Properties. You see, there is no CmsPosting_Saved event. The best compromise is CmsPosting_Changed event and check for PlaceholderPropertyChange action. But if there are five placeholders in a page, my routine will be run five times! More problematic is that this action does not take into account the situation when a page does not have any placeholders, like summary page for a channel cover. That's why I built it as a placeholder control.
This control will not render Custom Property of the selection type if it contains one allowed value only. This type of Custom Property setting is usually used for template logic and does not serve any authoring purpose since you cannot change the value.
The styling of the Custom Properties table rendered is not meant for customization. To set it apart from regular page content, the table uses the built-in CMS look and feel. The table title is customizable however, and is exposed through a public property TableTitle. The default value is "Custom Properties". Since all the table fields come with CSS classes, you can still use an external stylesheet to customize the look and feel of the table.
Installation Procedures
Please reference section "Custom Placeholder Controls" in CMS documentation. It is located in Site Development: Developing Your MCMS Site: Extending the Functionality of MCMS: Creating Custom Placeholders: Custom Placeholder Controls.
History
- V1.0 - 2004.01.30 - Base.
- V1.1 - 2004.05.05
- Added C# version.
- Background color of alternate table rows now renders properly.
- V1.2 - 2005.02.13 - Fixed error in authoring preview when custom properties are changed. (Please note that class namespace has been changed.)
| You must Sign In to use this message board. |
|
|
 |
|
 |
Hello,
I might be missing a trick here, but i have a Placeholder control similar to this one for setting custom properties but when i run it, it says "No value was given for placeholdertobind". I understand why this is happening, but how do i get around it? Its a shame that we cant choose a custom property to bind to.
Any ideas?
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
 |
A placeholder control needs to bound to a placeholder definition in the associated template. Even if your placeholder control does not save anything, you still need to create a placeholder definition and bind the control to it.
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
 |
Your code example is just what I was looking for.. I had made something similar but could not get it to work. My problem was that I tried saving custom properties at the same time as I was saving the posting for the first time. I still would like to do that. Is there a way that I can avoid saving the posting, switching back to editing and THEN edit the custom properties.
Thanks, Nikolaj
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi again,
Do you know if there is a Console plugin out there that lets you add custom properties to channels in browser edit mode?
The original one only lets you change custom properties in the browser. To add you will have to use the Site Manager.
/Erik
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
As far as I know, CMS API does not allow creation of Custom Properties in channels. But I am with you, it would be nice to be able to do it.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Yepp, checked the API and an ADD method is missing. At least I miss it. I guess it's safe to say that there is no console code out there that does this.
I also guess it could be accomplished working directly with the SQL server but that would be to ask for trouble.
Cheers /Erik
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
FYI in CMS02 you can tie in to posting events either through the old asp scope hooks (IIS_IR/wbc/customizable/hooks folder) or through a HTTP module. Obviously both are undesirable as they are at a global site level rather then localy but it would mean that you could eliminate the need to have an empty placeholder definition sitting there.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|