A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Anders Hattestad
Feb 1, 2011
  6958
(0 votes)

Know your enemy; Sun Tzu's The Art of War

If you wan to be able to archive your goals in a EPiServer project you need to know the product. And EPiServer have (thanks heaven) open dll’s so we can use reflector to browse thru the inner workings of the product. Sometime I guess they regret that decision, but I honestly think that's one of the things that make EPiServer as a product great.

Then back to topic, who can we know our enemy

A twitter user posted a tweet some days ago where he said: “Ohhh, I SOOO want an event to trigger when dynamic properties change. Please! #EPiServer

But instead of begging he should have tried to know his enemy, an start the all mighty reflector :)

AFAIK there are only one place dynamic properties are saved and that's in the EditDynProp.aspx. And that page have one button, called ApplyButton….

image

Here we see that there is a method SaveCollection that is called

image

And that calls a method Save

image

Which calls PopulatePropertyCommand

image

image

And here we see that OnBeforeSavingProperty is called

image

And here it is. BeforeSavingProperty, that's an event that get called when a dynamic property is saved. Either if it’s empty or have values. This event is only called when you save a dynamic property.

Code Snippet
  1. public class AttachEvents : PlugInAttribute
  2. {
  3.     public static void Start()
  4.     {
  5.         PageDB.BeforeSavingProperty += new EventHandler<PropertyEventArgs>(PageDB_BeforeSavingProperty);
  6.     }
  7.  
  8.     static void PageDB_BeforeSavingProperty(object sender, PropertyEventArgs e)
  9.     {
  10.         int a = 0;
  11.     }

This opens up some nice things that can be done. For instance create a version list on dynamic property page. Which is one of the feature I miss most.

It this event was not there we could also used PageAdaptors to hook our self up to the ApplyButton click event and done it there.

This feature have been around since CMS 5 it seems. So happy coding and use your Reflector when you can :)

Feb 01, 2011

Comments

Please login to comment.
Latest blogs
A day in the life of an Optimizely OMVP: Learning Optimizely Just Got Easier: Introducing the Optimizely Learning Centre

On the back of my last post about the Opti Graph Learning Centre, I am now happy to announce a revamped interactive learning platform that makes...

Graham Carr | Jan 31, 2026

Scheduled job for deleting content types and all related content

In my previous blog post which was about getting an overview of your sites content https://world.optimizely.com/blogs/Per-Nergard/Dates/2026/1/sche...

Per Nergård (MVP) | Jan 30, 2026

Working With Applications in Optimizely CMS 13

💡 Note:  The following content has been written based on Optimizely CMS 13 Preview 2 and may not accurately reflect the final release version. As...

Mark Stott | Jan 30, 2026

Experimentation at Speed Using Optimizely Opal and Web Experimentation

If you are working in experimentation, you will know that speed matters. The quicker you can go from idea to implementation, the faster you can...

Minesh Shah (Netcel) | Jan 30, 2026