Copied to clipboard

Flag this post as spam?

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


  • Mike Chambers 636 posts 1253 karma points c-trib
    Sep 30, 2010 @ 12:36
    Mike Chambers
    0

    Action handler before_save fires multiple times for a single document save...

    just doing a simple test at present, and struggling to understand the framework

     Document.BeforeSave += new Document.SaveEventHandler(Document_BeforeSave);

            void Document_BeforeSave(Document sender, umbraco.cms.businesslogic.SaveEventArgs e)
            {
                System.Web.HttpContext.Current.Response.Write("BEFORESAVE "  + sender.Id +"-" + sender.UpdateDate+ "<br/>");
            }

    For one click of the save button I get mutiple triggering of the Document_BeforeSave handler.. and depending on which property has been changed in the document I get differing UpdateDates than the one that is given on page_load for the document.

    Anyone care to explain... or point me in the direction of a resource?

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Oct 01, 2010 @ 00:13
    Aaron Powell
    0

    What version of Umbraco are you running?

  • Mike Chambers 636 posts 1253 karma points c-trib
    Oct 01, 2010 @ 10:16
    Mike Chambers
    0

    Apologies, I normal add that tech string...

    umb:4.5.2, windows vista, iis6, .net 3.5 sp1

    I have refactored slightly to now include in a compiled dll that sits in the bin folder

    using System;
    using System.Collections.Generic;
    using System.Text;
    using umbraco.cms.businesslogic.web;
    using umbraco.BusinessLogic;

    namespace UmbracoJPT
    {
        public class Concurrency : ApplicationBase
        {
            public Concurrency()
            {
                Document.BeforeSave += new Document.SaveEventHandler(Document_BeforeSave);
            }
            void Document_BeforeSave(Document sender, umbraco.cms.businesslogic.SaveEventArgs e)
            {
                System.Web.HttpContext.Current.Response.Write("APPLICATION BASE BEFORESAVE SENDER " + sender.UpdateDate + " :: " + sender.Id + "<br/>");           
            }
        }
    }

    So now on each save I get the response.write occuring twice.

  • Ed Bishop 53 posts 203 karma points
    Nov 28, 2010 @ 13:29
    Ed Bishop
    0

    I get this same problem, any ideas?

    I am on 4.5.2 IIS7 .net v4

    Cheers,

    Ed

Please Sign in or register to post replies

Write your reply to:

Draft