Changing default values on built-in EPiServer properties

A client was using CurrentPage.Changed.ToShortDateString() for displaying a Last updated date in the inner footer of their pages. They often, however, forgot to select the Mark page as changed-checkbox on the Settings tab, and asked me if it was possible to have it selected by default. Here is a simple way to do it.

Global.asax.cs

public class Global : EPiServer.Global
{
    protected void Application_Start(Object sender, EventArgs e)
    {
        EditPanel.LoadedPage += new LoadedPageEventHandler(AutoSelectMarkPageAsChangedCheckbox);
    }

    protected void AutoSelectMarkPageAsChangedCheckbox(EditPanel sender, LoadedPageEventArgs e)
    {
        e.Page["PageChangedOnPublish"] = true;
    }

In your Global.asax.cs file, add an event handler to the EditPanel’s LoadedPage event. Then use the LoadedPageEventArgs to change the value of the property. PageChangedOnPublish above is the checkbox Mark page as changed.

The Mark page as changed checkbox in EPiServer edit mode Settings tab.

3 Comments

  1. Valdis Iljuconoks November 1, 2011
    • mathias November 2, 2011
  2. Tobbe August 14, 2013

Leave a Reply