If I want to make programatically changes to a document when I'm saving it in the backoffice should I use Event Handlers or Action Handlers.
I might be missing something, but I think they both do the same
Action Handlers come from Version 3 and are only included for Backwards compatibilty. From Umbraco 4 I would always go for Event Handlers. Action Handlers are only supported on document object while Event Handlers are supported on almost every object.
v3 uses the action handler approach, v4 has introduced a more .net friendly event handling model, hence the new name 'Event handlers'. Apart from a few architectural changes, the goal remains the same.
Hi all, I realize I am resurrecting an OLD post, but I was wondering if you could weigh in on something for me...
I am looking to catch an Event that checks the document type that is being saved, then loops over all of the documents with that type and writes an XML file to disk. Seemingly simple...however, does anyone have any sample code for looping over documents in a .NET control based on type (alias)? Have done this countless times in XSLT, but never in c#.
Event Handlers or Action Handlers
Hi everyone,
If I want to make programatically changes to a document when I'm saving it in the backoffice should I use Event Handlers or Action Handlers.
I might be missing something, but I think they both do the same
thanks!
Pedro
Hi Pedro,
Action Handlers come from Version 3 and are only included for Backwards compatibilty. From Umbraco 4 I would always go for Event Handlers. Action Handlers are only supported on document object while Event Handlers are supported on almost every object.
Checkout the API Cheatsheet for using events. Also checkout my weblog for a list of all the events and a few examples.
Hop it helps you,
Richard
Hi,
v3 uses the action handler approach, v4 has introduced a more .net friendly event handling model, hence the new name 'Event handlers'. Apart from a few architectural changes, the goal remains the same.
A good tutorial and overview of available events can be found on Richard's blog: http://www.richardsoeteman.net
(http://www.richardsoeteman.net/PermaLink,guid,f470b6cf-40da-4aa9-a0d9-7b984fe9bf59.aspx)
Hope this helps.
Regards,
/Dirk
Got it! Event handlers it is!!!
thanks a lot!
Hi all, I realize I am resurrecting an OLD post, but I was wondering if you could weigh in on something for me...
I am looking to catch an Event that checks the document type that is being saved, then loops over all of the documents with that type and writes an XML file to disk. Seemingly simple...however, does anyone have any sample code for looping over documents in a .NET control based on type (alias)? Have done this countless times in XSLT, but never in c#.
Thanks,
Nik
Didn't do that before, but try umbraco.cms.businesslogic.web.Document.getContentOfContentType
Thomas
is working on a reply...