Customzing Custom Property

Vote:
 

Hi,

I have built a custom property which uses jquery plugin for custom select(customizes listbox). In the custom property I am using 'FindPagesWithCriteria' to get pages belonging to a particular 'PageType'. Now I want to use the same custom property which does the  'FindPagesWithCriteria' for a different 'PageType'. Is there any way by which I can make the admin select the 'PageType' while adding the custom property for a Page. Is it possible to provide dropdown option for the admin which displays all the available pagetypes. Like that if admin selects the pagetype to be used while adding the custom property, I can filter using 'FindPagesWithCriteria' for that page type. Otherwise I will have to add different custom properties which does pretty much the same, with only change being the pagetype value.

Is there any other approach to pass 'pagetype' dynamically?

Thanks in advance.

#43995
Sep 29, 2010 10:58
Vote:
 

Not sure what you are thinking about, but you can in one property access the value of other properties.

Look at [PropertyData].Parent thats a collection of the other page properties.

you have the same in the control part of the property, but there it's called Properties

#44000
Sep 29, 2010 11:30
Vote:
 
#44001
Sep 29, 2010 11:31
Vote:
 
#44002
Sep 29, 2010 11:31
Vote:
 

You don't specify which version of CMS you are using, but from CMS 6 you have the possibility of designing a property settings class for your property. You could use this to let the admin specify the page type in the settings for the property when adding it to the page. Read more about property settings here: http://labs.episerver.com/en/Blogs/Linus-Ekstrom1/Dates/2009/10/Settings-for-properties/

Edit: Here is another good post about this subject: http://www.frederikvig.com/2010/05/episerver-custom-property-with-custom-settings/

#44004
Edited, Sep 29, 2010 11:41
Vote:
 

I am using CMS 5 R2 SP2. Is there any work around for "possibility of designing a property settings class for your property" for CMS 5 R2 SP2. That is exactly what I need.

Thanks for the answers.

#44014
Sep 29, 2010 12:22
Vote:
 

I have accomplished this once by adding another property to the page type with a name on a known format. I wanted to set the root for the category tree to a page type specific value. I added a property called RootCategoryId{X} where X was the ID of the category. In my category property type I used the PropertyData.Parent like Anders did to get the full collection of properties. I could then find any property with a name starting with RootCategoryId and then parse the ID from the end of the name. Not a pretty solution, but it got the job done.

A different, and slightly less ugly way, could perhaps be to use the same name for the property ("RootCategoryId") on all page tyes, and use the default value to store the Id. You should somehow be able to find the default value from the property data via the property definition.

#44015
Sep 29, 2010 12:36
Vote:
 

That is a good one. But would you suggest me to take this approach even if I have multiple instances of the property on the same page.

My scenario:

For a 'Pagetype' I need to provide two custom properties(It might increase also). Both the properties should be Multiple select drop-downs(jquery plugin is being used).

Consider two page types as pagetypeA and pagetypeB. Now dropdown-1 should list all the pages of pagetypeA and dropdown-2 should list all the pages of pagetypeB for user to select.This I can easily achieve by making use of two different custom properties with different FindPagesWithCriteria. But instead of adding multiple custom property files I am trying to achieve this using a single custom property file.

#44027
Edited, Sep 29, 2010 13:26