Try our conversational search powered by Generative AI!

Overriding default functionality of standard LinkItemCollection Editor



I have a site that is using a three-way association between sites. WHat this means, is that on each page, I have a LinkItemCollection, pointing to another type - so an office can have many profiles, and a profile can be linked to many business line types. 

     [Display(Name = "Associated Profiles", Order = 80, GroupName = GroupNames.Associate)]
        public virtual LinkItemCollection AssociatedProfiles { get; set; }

The functionality I desire, is that when a profile is associated with an office/business line, a link gets added to that profile back from the business line/office... This functionality was provided by a GUIPlugin, which I have chosen to replace by using a PlugInAttribute, and create the association on Page Save. But what happens if I remove an item from the list? Unless I can disassociate that item from the other type immediately, I cannot go and remove the association on page save from the other type. 

Can anyone suggest a way of getting around this? Maybe tapping into the onItemRemoved event of the LinkPicker? 

Many thanks! 


Aug 27, 2015 16:57

Hook into content events for save, delete and handle those cases. You probably will need to grab some information from the the old page on the saving event to keep track of if links have been removed and handle those in saved event. Store that in context.items or similar. 

Feb 21, 2016 16:59
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.