Dynamic property save event

Vote:
 
Is there i dynamic property save event similar to DataFactory.Instance.SavedPage? I am trying to validate a property? Is it possible to hook onto any event or should i implement a custom property?
#23762
Sep 15, 2008 15:33
Vote:
 

No, it is not as easy as with the DataFactory.Instance.SavedPage event.

The only way to capture changes to dynamic properties (without creating your own property control type of course) is to hook:

PageDB.BeforeSavingProperty += PageDBBeforeSavingProperty;
private static void PageDB_BeforeSavingProperty(object sender, PropertyEventArgs e)
{
    if (e.Property.IsDynamicProperty && e.Property.IsModified)
    {
// This is executed when a dynamic property is modified but BEFORE it is saved to the database
// e.CurrentPage can be used to discover the page being modified.
}
}
Rember that this is executed in the data layer once for each property when you are saving. There is no way to cancel but you can change the value or record that a dynamic property is changed on a page.

/Fredrik 

#23767
Edited, Sep 15, 2008 22:06
Vote:
 

Thank you for the quick reply.

So if I want to be able to cancel changes in dynamic properties as is possible for page properties in SavingPage or GlobalPageValidators I will need to build a custom property?

#23774
Sep 16, 2008 7:44
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.