Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am playing with events in Umbraco 7 but I have an event which seems not to be triggered.
What I am intending to do is cancel the deletion of content node called "Home".
But while debugging, it seems that ContentService_Deleting method isn't hit at all.
I tried ContentService.Saving (in another test) and that is wokring perfectly. So i thought that Deleting would work somewhat the same.
I wonder what I am doing wrong. Any help would be appreciated.
This is what I have:
public class CustomEvents : ApplicationEventHandler
ContentService.Deleting += ContentService_Deleting;
void ContentService_Deleting(IContentService sender, DeleteEventArgs<IContent> e)
foreach (var node in e.DeletedEntities)
if (node.Name == "Home")
e.Cancel = true;
Did you try deleting it by emptying the recycle bin? Otherwise it might not be triggered because it's only being moved to the recycle bin.
Yes good point! I was thinking in the wrong direction. What I needed was ContentService.Trashing...overlooked that one.
Do you happen to know how I can force some kind of refresh after the trashing is cancelled? Because the node is visually deleted but it's still there after a refresh in the backend. That the node is still in place is a good thing of course that was my intention but a refresh somehow would be perfect.
Thanks a lot for pointing me in the right direction!
Sorry I don't think that is possible. The events aren't linked to the UI. You can show a cancel message in the speech bubble, but that's it probably. Please mark a post as the solution if it helped you.
Thanks for your quick reply! Is there somewhere documentation about the speech bubble?
Here are some links:
Thanks Jeroen. I will try those examples. I just had my reservation because those post were many years old. But if it still applies I think that's fine.
Those examples don't work in Umbraco 7.2 - trying to cast the current handler as a page errors. I'm still trying to figure out how to (1) show a speech bubble inside of an event and (2) cancel the page / tree change, or refresh the entire page because removing a node from the tree when the node was not actually removed is misleading.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted