Copied to clipboard

Flag this post as spam?

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


  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Feb 05, 2010 @ 13:56
    Jeroen Breuer
    0

    SpeechBubble during delete event.

    Hello,

    I've got a media item, and I want to add some business logic that it can't be deleted if it's related to some other (custom) tables. If the delete is canceled I'd like to inform the user the delete action has been canceled. Can I call the speechBubble method or some other javascript method to inform the user? My code now looks like this:

    public class ProjectApplicationBase : ApplicationBase
        {
            public ProjectApplicationBase ()
            {
                #region Events

                Media.BeforeDelete += new Media.DeleteEventHandler(Media_BeforeDelete);

                #endregion
            }


            protected void Media_BeforeDelete(Media sender, umbraco.cms.businesslogic.DeleteEventArgs e)
            {
                int countValue = Convert.ToInt32(sender.getProperty("mediaCount").Value);

                if (countValue > 0)
                {
                    //Some code to show a pop-up the item has not been deleted.

                    e.Cancel = true;
                }
            }
        }

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 05, 2010 @ 14:42
    Dirk De Grave
    1

    Jeroen,

    Check Richard's blog and the codeplex item (And vote for it!)

     

    Cheers,

    /Dirk

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Feb 05, 2010 @ 14:51
    Jeroen Breuer
    0

    Thanks Dirk, I voted for the workitem. Hope it will be available soon (4.1).

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies