SaaS CMS has officially launched! Learn more now.

SavingContent event - update block content - values not updated



I am updating content on a block in the SavingContent event.

    public class BlockEventsInitialization : IInitializableModule
        private IContentEvents _events;

        public void Initialize(InitializationEngine context)
            _events = ServiceLocator.Current.GetInstance();

            _events.SavingContent += SavingContent;

        private void SavingContent(object sender, ContentEventArgs e)
            var block = e.Content as MyTestBlock;

            if (block != null)
                block.Text = "New text";

                e.Content = block as IContent;

        public void Uninitialize(InitializationEngine context)
            _events.SavingContent -= SavingContent;

In my case I am replacing blocks in a ContentArea, this is just a small example with the same result.

The Text property does not say "New text" until I reload the page, hitting "Ready to Publish", actually publish the block or go to another block/page and then go back the block I am updating.

I do not want to publish my changes, just save.

Anyone have an idea how to update values without reloading or publish the block?


Edited, Mar 26, 2018 12:57

This should do the trick for you:

Mar 26, 2018 21:29

Hi Magnus

You need to call CreateWritableClone and update the returned instance. By default all content is readonly for performance. I'm actually a little surprised an exception wasn't thrown. Something like this should do the trick:

var updateBlock = block.CreateWritableClone();
updateBlock.Text = "New Text";
e.Content = updateBlock as IContent;


Mar 26, 2018 22:05

Thanks for the response Aniket and David!

Setting e.Content with a CreateWritableClone() gives the same result, David.

Simplest possible scenario gives the same result:

        private void SavingContent(object sender, ContentEventArgs e)
            e.Content.Name = "New name";

The new value is not presented in the "All Properties" view until I do one of these:

  • A page refresh
  • Ready to Publish
  • Publish Changes
  • Navigate to another page/block and back

PS. Just to be clear; I am only referring to the "All Properties"-view and not "On-Page Editing"-view.

Best regards

Edited, Mar 26, 2018 22:57

Hey Magnus

Sorry I mis-read your original post. Will have a think about your issue and get back to you. 


Mar 26, 2018 23:21

might be related to the case when value set on the client side is not the same that was mutated on the server. resulting in some weird dojo-mojo caching thingies?!

Mar 27, 2018 16:55

Did anyone find a solution to this? I'm attempting similar property changes on SavingConent and not having luck with the All Properties view refreshing afterwards

Jun 20, 2019 18:07

Valdis, I think weird dojo-mojo caching thingies is going to be the name of my next band. Lol!

Jun 21, 2019 15:56

Does anyone found and answer for this? Looking at similar problem.

I've been able to tell that that after save and event completing, server returns field with updated value. So seems like some events on UI are not taking that information into account.

Edited, Sep 25, 2020 10:00

I've recently come accross this issue was well, has anyone come up with a resolution?

Feb 25, 2021 23:20

Here is a solution to this issue.

Please note, this is supported in CMS UI 11.36.0  and greater as mentioned.

Jul 06, 2022 6:08
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.