Lee Crowe
May 4, 2011
  3029
(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
Vulnerability in EPiServer.GoogleAnalytics v3 and v4

Introduction A potential security vulnerability was detected for Optimizely Google Analytics addon (including EPiServer.GoogleAnalytics and...

Bien Nguyen | Sep 20, 2023

Overriding Optimizely’s Content Recommendations Block to Implement Custom Recommendations

Introduction The Content Recommendations add-on for Optimizely CMS dynamically recommends content from your site tailored to the interests of each...

abritt | Sep 13, 2023 | Syndicated blog

Developer contest! Install the AI Assistant and Win Bose QC45 Headphones!

We are thrilled to announce a developer contest where you have the chance to win a pair of Bose Headphones. The goal is to be the first developer t...

Luc Gosso (MVP) | Sep 7, 2023 | Syndicated blog

Send Optimizely notifications with SendGrid API, not SMTP

If your Optimizely site already sends transaction emails through an email platform API, why not do the same with Optimizely notification emails?

Stefan Holm Olsen | Sep 6, 2023 | Syndicated blog