Hi!
I do something similar to this example from the documentation:
private void onSavingPage(object sender, EPiServer.PageEventArgs e)
{
if (e.Page.Property.Exists("MainBody"))
{
string sMainBody = (string)e.Page.Property["MainBody"].Value;
// Replace XML and tags using the following regular expression
sMainBody = System.Text.RegularExpressions.Regex.Replace(sMainBody, @"(<\?.*\ />)|(]*>)|(<]*>)", "");
e.Page.Property["MainBody"].Value = sMainBody;
}
}
// This hooks the event
protected void Application_Start(Object sender, EventArgs e)
{
EPDataFactory.SavingPage += new EPiServer.PageEventHandler(onSavingPage);
}
]*>
And the property value is modified as you would expect. However the new value of the property is not reflected in the editor when you use the Save-button. It works fine when you do a Publish or Save and view (but then you also have a switch of views/a new read from server).
So it seems like when you hit Save, it doesn't do a new read from server, but only use the viewstate or something...?
Is there a solution out there?
Thanks!
private void onSavingPage(object sender, EPiServer.PageEventArgs e) { if (e.Page.Property.Exists("MainBody")) { string sMainBody = (string)e.Page.Property["MainBody"].Value; // Replace XML and tags using the following regular expression
sMainBody = System.Text.RegularExpressions.Regex.Replace(sMainBody, @"(<\?.*\ />)|(]*>)|( <]*>)", "");
e.Page.Property["MainBody"].Value = sMainBody;
}
}
// This hooks the event
protected void Application_Start(Object sender, EventArgs e)
{
EPDataFactory.SavingPage += new EPiServer.PageEventHandler(onSavingPage);
}
]*>
And the property value is modified as you would expect. However the new value of the property is not reflected in the editor when you use the Save-button. It works fine when you do a Publish or Save and view (but then you also have a switch of views/a new read from server). So it seems like when you hit Save, it doesn't do a new read from server, but only use the viewstate or something...? Is there a solution out there? Thanks!