Try Now
More in this section

Forums / Developing with Sitefinity / ModuleBuilder - Events (such as OnCreate or OnUpdate)

ModuleBuilder - Events (such as OnCreate or OnUpdate)

2 posts, 0 answered
  1. Brian
    Brian avatar
    7 posts
    28 Jan 2014
    22 Apr 2014
    Link to this post

    I have written a module using the Module Builder.  It has a Content Type called "Slide".  I have written a widget that creates a slideshow for a homepage using a jQuery script to loop through the Slides with nice effects (it's a fancier Rad Rotator).   That works wonderful.

    However, on the back-end in the create/edit screens, we need to re-order the slides when we want to feature a new slide in the #1 spot.  I would like to do one of two things:

     1. Override the default Create method so I can call that base functionality PLUS update all other Slides On Create, or

     2. Add an event trigger that will serve as a callback command after a create, update, or delete event for a Slide.


  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    19 Oct 2016
    24 Apr 2014
    Link to this post
    Hello Brian,

    I suggest you subscribe for the IDataEvent, which is fired for Create, Update, Delete of content items. You should add the following code snippet to your Global.asax file:

    protected void Application_Start(object sender, EventArgs e)
               Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
           void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
               if (e.CommandName == "Bootstrapped")
           private void Content_Action(IDataEvent @event)
               var action = @event.Action;
               var contentType = @event.ItemType;
               var itemId = @event.ItemId;
               var providerName = @event.ProviderName;
               var manager = ManagerBase.GetMappedManager(contentType, providerName);
               var item = manager.GetItemOrDefault(contentType, itemId);

    You can add the file, if you do not have it in your solution from New Items -> Global Application File. The event will be fired when you update or create your dynamic item. The manager will get the item and you will be able to plug your code.
    I hope this helps.

    Nikola Zagorchev
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered