Can you please provide full code (interested in part how you subscribe to event)?
Hi,
Maybe you need to assign contentArea to property
var page = e.Content as StandardPage; if (page.MyContentArea != null && page.MyContentArea.Items.Any()) { var contentArea = page.MyContentArea; var clone = page.CreateWritableClone() as StandardPage; foreach (var contenAreaItem in contentArea.Items) { contentArea.Items.Remove(contenAreaItem); } // assign contentArea to property page.MyContentArea = contentArea; DataFactory.Instance.Save(clone, SaveAction.Save, AccessLevel.NoAccess); }
[Valdis] : this is the event that u subscribe. DataFactory.Instance.SavingContent += SavingContent;
[Grzegorz] : yes, you right I needed to assing contentArea to property.
Thank you for your help.
If you do SavingContent (before the actual save) you shouldn't need to save yourself.
If you do SavedContent (after saving has been done) you need to.
I wasn't aware that you need to re-assign CA to the property to get it populated. Weird
That is the most common way I've seen to trigger IsModified on the CA.
EPiServer doesn't care about the value if IsModified is false
I m trying to modify content area programmaticly, but can not get it work. By hooking save event on episerver, I should be able to modify the content area on savingContent.
this simple logic is to delete content items on contentarea but does not save and refresh backend page.
any help appreciated