Sometimes you might want to alter a value that is being loaded when editing a page in EPiServers edit mode. In EPiServer CMS we have added a new event that makes it possible to alter a page's values only when loaded in edit mode. Here is a code example of how this can be done by attaching to an event in the Global class (global.asax.cs):
public class Global : EPiServer.Global { protected void Application_Start(Object sender, EventArgs e) { EditPanel.LoadedPage += new LoadedPageEventHandler(EditPanel_LoadedPage); } protected void EditPanel_LoadedPage(EditPanel sender, LoadedPageEventArgs e) { e.Page.PageName += "[Test]"; e.Page["PageChangedOnPublish"] = true; } }
You can no longer change the values for the page properties in the
DataFactory events if the page is in read-only mode. See
Read-Only PageData Cache for further reference.