public class DataManager : ApplicationBase { #region Public Members public DataManager() { Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish); Document.AfterDelete += new Document.DeleteEventHandler(Document_AfterDelete); }
Did you already try to set a breakpoint on the AfterDelete event handler? Also this event gets fired when you empty the trash not when you delet the item in Umbraco.
I've tried the AfterMoveToTrash event and in debug mode its not getting to the breakpoint and the page is not even deleteable it just stays in the tree.
using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Web.UI; using System.Text.RegularExpressions;
using umbraco.BusinessLogic; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.web; using umbraco.presentation.nodeFactory;
namespace Precedent.ACS.Data { public class DataManager : ApplicationBase { #region Public Members public DataManager() { Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish); //Document.AfterDelete += new Document.DeleteEventHandler(Document_AfterDelete); Document.AfterMoveToTrash += new Document.MoveToTrashEventHandler(Document_AfterMoveToTrash); }
AfterDelete & AfterSendToTrash dont seem to be working
Hi All,
I'm trying to fire some an event handler when the editor deletes a page but I cant seem to capture that event.
I have tried
And nothing seems to work, all I get is that I'm not able to delete and pages/nodes from the content tree.
I'm using Umbraco 4.0.3
Thanks
Tom
There are certain events that don't fire at all.
If you are convinced that one isn't working then I'd file a bug.
I've fallen into the trap on a few occasions of not having my event handling class marked public - in which case it won't work.
Hi Tom,
I've used these events with 4.0.3. Please provide some sourcecode.
Cheers,
Richard
Hi Richard,
This is part of my code.
Darren,
I've also tried making it public but still no difference :(
Thanks
Tom
Can you post the whole class?
What isn't working? Have you tried putting some logging in to see whether your event is fired but the business logic is failing?
As Darren mentioned can you provide the whole class, I think you don't derive from ApplicationBase.
Cheers,
Richard
Hi Guys
This is my whole class:
)
The AfterPublish method is working no problem and fires everytime.
Thanks
Tom
Did you already try to set a breakpoint on the AfterDelete event handler? Also this event gets fired when you empty the trash not when you delet the item in Umbraco.
Cheers,
Richard
I think you want the AfterMoveToTrash event. I don't think afterdelete is fired until the recycle bin is emptied.
I've tried the AfterMoveToTrash event and in debug mode its not getting to the breakpoint and the page is not even deleteable it just stays in the tree.
Thanks
Tom
Post your class again and i'll run it locally. I have 4.0.3 installed.
Hi Darren,
This is the entire class.
Thanks
Tom
The issue isn't the code.
I copied it as is and I can hit the breakpoint:
hmm...
Stupid question but how are you deleting the page from the tree to get to that breakpoint?
Tom
right click. then delete.
Right this is now working, just deleted the AfterMoveToTrash and now it works.
Thanks for looking into this Darren much appreciated.
Tom
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.