Copied to clipboard

Flag this post as spam?

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

  • Michaël Vanbrabandt 863 posts 3347 karma points c-trib
    Feb 06, 2018 @ 15:41
    Michaël Vanbrabandt

    Fire package controller function after clicking custom menu item

    Hi all,

    I have a BootStrapper class which adds a new menu item on the members menulist.

    I was wondering if its possible to fire a function inside my controller after hitting this menu item, or do we first need to show a dialog which then calls the controller function after hitting another button inside the dialog?

    public class PackageApplicationEventHandler : ApplicationEventHandler
        protected override void ApplicationStarted(
            UmbracoApplicationBase umbracoApplication, 
            ApplicationContext applicationContext)
            TreeControllerBase.MenuRendering += Package_MenuRendering;
        private void Package_MenuRendering(TreeControllerBase sender, MenuRenderingEventArgs e)
            // If not rendering menu for the document types, return
            if (sender.TreeAlias != "member") return;
            var menuItem = new Umbraco.Web.Models.Trees.MenuItem("package", "Package Item");
            menuItem.Icon = "client";
            // Append someting to fire controller function inside 
            // my App_Plugins/Package folder after hitting this menu item
            menuItem.SeperatorBefore = true;
            e.Menu.Items.Insert(e.Menu.Items.Count, menuItem);


  • Dave Woestenborghs 3494 posts 12077 karma points MVP 7x admin c-trib
    Feb 06, 2018 @ 16:09
    Dave Woestenborghs

    Hi Michaël,

    I don't think this is possible. But I think you can still execute javascript from the menu. There is a ExecuteLegacyJs function on the menu item :


  • Michaël Vanbrabandt 863 posts 3347 karma points c-trib
    Feb 06, 2018 @ 17:17
    Michaël Vanbrabandt

    Hi Dave,

    thanks for the intel, I will then launch a new view to do the task.


Please Sign in or register to post replies

Write your reply to: