Righto, I'm getting a headche. I'm using Document_AfterSave to check a property value. If the value meets a certain criteria it is changed, the document re-saved and a warning message displayed. All good, works nicely.
What doesn't work is the property displayed in the back office remains as the previous value until the node is reloaded. I understand why, but would like to update the displayed value to the new value when it is updated in _AfterSave, just like it would be on a regular save event.
I've tried to work from examples using parent.refreshNode, with no success.
Is this possible? Code snippet below - any suggestions would be awesome. I'm on 4.7.1.
void Document_AfterSave(Document sender, umbraco.cms.businesslogic.SaveEventArgs e) { DateTime dt= Convert.ToDateTime(sender.getProperty("date").Value.ToString()); TimeSpan ts = date- DateTime.Now; if (ts.Days > 180) { Page page = HttpContext.Current.Handler as Page; sender.getProperty("date").Value = DateTime.Now.AddDays(90); sender.Save(); page.ClientScript.RegisterClientScriptBlock(this.GetType(), "s", "alert();", true);
///Need some magic here to refresh the node... /// } }
Update node from _AfterSave
Righto, I'm getting a headche. I'm using Document_AfterSave to check a property value. If the value meets a certain criteria it is changed, the document re-saved and a warning message displayed. All good, works nicely.
What doesn't work is the property displayed in the back office remains as the previous value until the node is reloaded. I understand why, but would like to update the displayed value to the new value when it is updated in _AfterSave, just like it would be on a regular save event.
I've tried to work from examples using parent.refreshNode, with no success.
Is this possible? Code snippet below - any suggestions would be awesome. I'm on 4.7.1.
This topic might help, but it doesn't have a solution: http://our.umbraco.org/forum/developers/extending-umbraco/31225-Updating-property-value-on-Save
Jeroen
is working on a reply...