Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Lee Crowe
May 4, 2011
  3130
(1 votes)

EPiServer FilteredPageReference Property Controls v1.3 Released

For those of you who are not aware of the Filtered Page Reference property controls I have created please refer to the following two blog posts:

Missing Feature

One of the features that was irritating me a bit about the FilteredPageReference property controls I created was their inability to function correctly when they were not page property definitions of a page type.

For example if the property was added programmatically to a page for editing or used by my Multiple Property Controls any property settings set against the property would be lost as they were not persisted through the various popup dialogs.

The Solution

v1.3 of the assembly persists the property settings in the users session if the property instance does not belong to a PageData object.  This ensures that any property settings set either by using my Multiple Property Controls or possibly by the next version of PageTypeBuilder (if it will allow property settings to be programatically defined against a page type property.  Joel will this be in the next version?) will be persisted through the various dialogs and the filtered page picking functionality will be consistent wherever it is used. Although session may not be the best solution it was the simplest to implement.

Code Example

The code example below demonstrates how you would programmatically set the FilteredPageReference property settings while using a property that is based on the Multiple Property Controls.

   1:  namespace EPiServer.Entities
   2:  {
   3:      using System;
   4:      using System.Runtime.Serialization;
   5:      using Core;
   6:      using ElencySolutions.MultipleProperty;
   7:      using FilteredPageReference;
   8:      using PageTypes;
   9:      using SpecializedProperties;
  10:   
  11:      [Serializable]
  12:      [DataContract]
  13:      [KnownType(typeof(Entity))]
  14:      public class Entity
  15:      {
  16:   
  17:          [MultiplePropertyEntityProperty(Caption = "Filtered Page Reference",
  18:              Type = typeof(PropertyFilteredPageReference),
  19:              SortIndex = 100,
  20:              Required = false,
  21:              PropertySettingsCreator = typeof(FilteredPageReferenceSettingsCreator))]
  22:          [DataMember]
  23:          public PageReference FilteredPageReference { get; set; }
  24:   
  25:          [MultiplePropertyEntityProperty(Caption = "Filtered Page References",
  26:              Type = typeof(PropertyFilteredLinkCollection),
  27:              SortIndex = 110,
  28:              Required = false,
  29:              PropertySettingsCreator = typeof(FilteredPageReferenceSettingsCreator))]
  30:          [DataMember]
  31:          public LinkItemCollection FilteredLinkCollection { get; set; }
  32:   
  33:      }
  34:   
  35:      public class FilteredPageReferenceSettingsCreator : IMultiplePropertySettingsCreator
  36:      {
  37:          public Core.PropertySettings.IPropertySettings CreatePropertySettings()
  38:          {
  39:              PropertyFilteredPageReferenceSettings settings = new PropertyFilteredPageReferenceSettings
  40:              {
  41:                  AllowedPageTypesAndInterfaces = new[]
  42:                                                      {
  43:                                                          typeof(ImageMapPageType), 
  44:                                                          typeof(HotSpotPageType)
  45:                                                      },
  46:                  AllowQuickEdit = true,
  47:                  StartFromCurrentPage = true
  48:              };
  49:              
  50:              return settings;
  51:          }
  52:      }
  53:   
  54:  }

Installation and Setup

The FilteredPageReference assembly will only work with EPiServer CMS 6 and onwards.

To install just simply place the assembly into your web applications bin folder.  The assembly can be downloaded from

http://episerverfpr.codeplex.com/.

 

Have feedback?

Please feel free to email or twitter me with any feedback @croweman

May 04, 2011

Comments

Please login to comment.
Latest blogs
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog