ILearnable .Net

May 16, 2006

Making Custom Properties aware of their context in EPiServer

Filed under: Uncategorized — andreakn @ 00:30

What you might want to do inside a custom property is to check the value of some other properties in the current page. What you will notice is that Custom Properties are not aware of the CurrentPage, in order to fetch it you will need to override the
InitializeData method that the base class of all EPiServer properties has.

You can get the pagereference within that method

PageReference _pageLink;

public override void InitializeData(EPiServer.ApplicationConfiguration config,PropertyDataCollection properties)
{
PropertyPageReference pageLinkProperty = properties[“PageLink”] as PropertyPageReference;
if (!pageLinkProperty.IsNull) { _pageLink = pageLinkProperty.PageLink;}
base.InitializeData(config, properties);
}

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: