This post shows a few more things how Kentico global event handling can be extended to add more functionality to Kentico admin interface without need to modify Kentico built-in controls.
To implement such requirements you can find the file of the header action control in the Kentico project and add your logic to the code of that control. But as we may know modifying Kentico build-in controls is not really good practice as after upgrade to newer Kentico version your code might be rewritten and you will need to add this logic again. Do you agree? :)
public partial class CMSModuleLoader
/// Custom attribute class for the CMSModuleLoader.
private class CustomizationLoaderAttribute : CMSLoaderAttribute
/// Called automatically when the application starts.
public override void Init()
//Assigns handler to display popup message
private void EditMenu_OnAfterUserControlPreRender(object sender, EventArgs e)
HeaderActions headerActions = sender as HeaderActions;
if (headerActions != null && headerActions.ActionsList.Count > 0)
if (PortalContext.ViewMode == ViewModeEnum.EditForm || PortalContext.ViewMode == ViewModeEnum.EditLive || PortalContext.ViewMode == ViewModeEnum.Edit)
List<HeaderAction> saveActionsList = headerActions.ActionsList.FindAll(p => p.EventName == "Save");
foreach (HeaderAction action in saveActionsList)
action.OnClientClick += "return confirm(\"Do you want to save the document?\");";
If you find this post usefull please leave your comments below. Thanks in advance, Mariia.