Issue with Items.Clear() in ContentArea

Vote:
 

Hi,

I was writing a scheduled job to move items from a ContentArea in a local block to a ContentArea on the actual page. Copying the items was no problem, but removing them from the old contentarea was more of a challenge. What I expected to work was to call writableClone.LocalBlock.ContentArea.Items.Clear(). This had no effect however. Eventually I resorted to create a temporary list of ContentAreaItems to delete, and then call writableClone.LocalBlock.ContentArea.Items.Remove(contentAreaItemToDelete) for each item.

Shouldn't Items.Clear() have sealed the deal?

#113531
Nov 24, 2014 10:22
Vote:
 
<p><span>Did you try writableClone.LocalBlock.ContentArea = null?</span></p>
#113532
Nov 24, 2014 10:51
Vote:
 
<p>If you take a deeper look on how content area Items are implemented then you can see that there is an observable collection of items with collection change event handler built out of current Fragments. I guess that direct .Clear() should not have any effect. You have to remove item by item to notify subscribers. That's exactly what CMS UI does.</p>
#113569
Nov 24, 2014 22:14
* 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.