Copied to clipboard

Flag this post as spam?

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


  • Marko Ivanovski 14 posts 124 karma points
    May 05, 2011 @ 23:50
    Marko Ivanovski
    0

    Modifying properties in Document_AfterSave and showing the new values

    Hi guys,

    I've written a class which inhertis from ApplicationBase and hooks up to the Document.AfterSave event.

    Document.AfterSave += new Document.SaveEventHandler(Document_AfterSave);

    Inside the event handler, I'm modifying some properties and I'd like to show these new values rather than the old ones. i.e.

    void Document_AfterSave(Document sender, umbraco.cms.businesslogic.SaveEventArgs e) {
    sender.getProperty("latitude").Value = lat;
    sender.getProperty("longitude").Value = lon;
    sender.Save();
    if (sender.Published)
    {
    sender.Publish(new User(0));
    umbraco.library.UpdateDocumentCache(sender.Id);
    }
    }

    At the moment, I have to click on the node in the tree again, navigate to the tab I was on to see the newly set values. Is there a way to do this programatically, i.e. refresh the content editor and navigate to the tab I was on?

  • Aximili 177 posts 278 karma points
    Jun 17, 2011 @ 02:52
    Aximili
    0

    I am having the same problem. Did you find any solution?

    Btw I don't think you need to check if published explicitly, I think publish is called after save

  • Marko Ivanovski 14 posts 124 karma points
    Jun 17, 2011 @ 03:56
    Marko Ivanovski
    0

    Hi @Hardi, no I haven't unfortunately.

    The reason I'm checking for (sender.Published) is because I only want to Publish if the node was initially published. If that makes sense :)

Please Sign in or register to post replies

Write your reply to:

Draft