I'm not quite sure what's happening, but everytime the BeforeDelete event fires, the deleted entrie says Deleting.. and get's stuck there, with the page done loading. If I refresh the page, the Data Types tree no longer populates and I have to reinstall Umbraco. My code is simple and I can't see what's causing the problem.
namespace NutsAndBolts.Tables { public class DataTypeDeleteEvents : ApplicationBase { public DataTypeDeleteEvents() { DataTypeDefinition.BeforeDelete += new EventHandler<umbraco.cms.businesslogic.DeleteEventArgs> (DataTypeDefinition_BeforeDelete); }
Oh.. snap... How else would I go about debugging this code in this event, it seems that normal debugging kills the rendering as well and cause the same problem. That's why I tried to Response.Write information but I suppose I can't do that either.
Working with events
I would like to fire an event before deletion of my Data Types, any ideas how I can achieve that.
As far as I know there is no Event for that so the best you could do is create a ticket on Codeplex asking to implement this into Umbraco.
Cheers,
Richard
Oopsss, I'm sorry
Try the umbraco.cms.businesslogic.datatype.DataTypeDefinition.Deleting event. For an overview of all events, check out http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/overview-of-all-events
Then you can use ApplicationBase to register your event in the constructor of your class. A tutorial can be foudn at http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events
In your case the code would look similare to this:
Thanks alot, I'm quite sure this will do the trick.. I do however need to catch the NodeID that fires the delete event, how would I do that?
I think that will be included in the sender parameter, you should set a breakpoint and see what happens.
Thanks again Richard, your awesome!
I'm not quite sure what's happening, but everytime the BeforeDelete event fires, the deleted entrie says Deleting.. and get's stuck there, with the page done loading. If I refresh the page, the Data Types tree no longer populates and I have to reinstall Umbraco. My code is simple and I can't see what's causing the problem.
I think you kill the rendering using the line HttpContext.Current.Response.Write
Oh.. snap... How else would I go about debugging this code in this event, it seems that normal debugging kills the rendering as well and cause the same problem. That's why I tried to Response.Write information but I suppose I can't do that either.
You can attach your debuuger to the worker process and set a breakpoint. Check out this post from Tim how to do that.
That's what I did and it broke the rendering, so now I'm just using log entries to check my information.
Thanks for all your assistance, you've been great.
is working on a reply...