November Happy Hour will be moved to Thursday December 5th.

How to add (and remove) custom page properties

Vote:
 

I'l like to add a custom mode property that I can use in my page types. In this example I would like to add a DropDownList and I would like to get the values for it from an SQL table. I've tried creating a property before and right now I've got about 11 of those in the list of properties.

First, how do I remove these?

Second, what is the "right way" to create a custom property? Feels like I must had done something wrong here since I get a whole lot of the same property even though I removed the code for it.

#49489
Mar 21, 2011 11:41
Vote:
 

Go to admin mode, select 'Page Type' tab, click 'Edit Custom Property Types' in 'Manage Page Types' section and remove unnecessary properties types.

Most probably there will be different class names (namespaces / assemblies) from which the property types are loaded.

#49490
Mar 21, 2011 11:52
Vote:
 

Just as you wrote how to delete them I found them, but thank you for the reply!

How come it created so many how them?

#49491
Mar 21, 2011 11:56
Vote:
 

EPiServer browse your code for classes with [PageDefinitionTypePlugIn] attribute. If there is no property that matches to the found class (Assembly, Namespace, Classname have to be identical), the new property is created. So if you renamed your class couple times and moved it across 2 or 3 namespaces, every time the new property type was registered in EPiServer.

#49493
Mar 21, 2011 12:28
Vote:
 

Hmm. I don't think I did that but I'm going to try again now that I've found how to delete them. Thanks for all your help!

#49494
Mar 21, 2011 13:35
Vote:
 

How do I create a custom dropdownlist? I can't seem to find how I did it last time?

I right click in Visual Studio, choose to create a new item and choose "Custom property", right? DropDownList is not an option there.

#49495
Mar 21, 2011 14:09
Vote:
 

Well a drop down isn't how the property is stored. It is stored for example as a string. The property presenter is however a drop down.

Check this blog post:

http://shahinalborz.se/2011/02/episerver-custom-property-dropdown/

or

http://labs.episerver.com/en/Blogs/Allan/Dates/112230/3/Custom-Property-Category-Drop-Down/

#49499
Edited, Mar 21, 2011 15:24
Vote:
 

Once again I managed to find the answer just before someone posted it. Thanks though, I appreciate it!

#49500
Mar 21, 2011 15:26
Vote:
 

When I'm in edit mode my drop down doesn't remember what I picked last time. I assume I need to override some function for it to get the stored value but which one?

#49551
Mar 23, 2011 9:21
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.