Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • pvassalo 21 posts 28 karma points
    Apr 20, 2009 @ 11:53
    pvassalo
    0

    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

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Apr 20, 2009 @ 12:01
    Richard Soeteman
    1

    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

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 20, 2009 @ 12:01
    Dirk De Grave
    1

    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


  • pvassalo 21 posts 28 karma points
    Apr 20, 2009 @ 12:50
    pvassalo
    0

    Got it! Event handlers it is!!!
    thanks a lot!

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jul 24, 2009 @ 14:41
    Nik Wahlberg
    0

    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

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jul 24, 2009 @ 16:54
    Thomas Höhler
    0

    Didn't do that before, but try umbraco.cms.businesslogic.web.Document.getContentOfContentType

    Thomas

Please Sign in or register to post replies

Write your reply to:

Draft