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;
David
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:
PS. Just to be clear; I am only referring to the "All Properties"-view and not "On-Page Editing"-view.
Best regards
Magnus
Hey Magnus
Sorry I mis-read your original post. Will have a think about your issue and get back to you.
David
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?!
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
Valdis, I think weird dojo-mojo caching thingies is going to be the name of my next band. Lol!
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.
I've recently come accross this issue was well, has anyone come up with a resolution?
Here is a solution to this issue.
Please note, this is supported in CMS UI 11.36.0 and greater as mentioned.
Hi!
I am updating content on a block in the SavingContent event.
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?
/Magnus