Tuesday, May 16, 2006

Making Custom Properties aware of their context in EPiServer

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);
}

1 comment:

Anonymous said...

In today’s internet savvy world an online presence is a must for any organization weather big or small, but just a mere website of the company wont serve the purpose of reaching out and impressing the target audience, your online presence should leave an impact on the mind of the viewers, and from here comes website designing and development companies of Delhi, search engine optimization and marketing companies of Delhi and internet marketing services providing companies of Delhi in picture. These companies provide end to end solutions for all your website related issues.