Setting the PageStopPublish value based upon the value of another Property


I have a case where I need to set the PageStopPublish of a page, based on the value of another property, but PageStopPublish doesn't seem to get set. 

I noticed that it is possible to set the stop publish in the SetDefaultValues property, but this is too early in the flow, so what I've tried is this.

public virtual DateTime? DueDate
            get { return this.GetPropertyValue(x=>x.DueDate); }
                if (value != null)
                    this.Property["PageStopPublish"].Value = value;
                    this.StopPublish = value;
                this.SetPropertyValue(x => x.DueDate, value);

but the stop publish doesn't seem to get set in the UI.

I've also tried adding the DueDate property as a fullrefresh property but even then the StopPublish isn't set.

Is it possible to solve this without a global event handler ?

Apr 18, 2016 12:55

Have you tried using PageData.StopPublish property instead of PageData.Property["PageStopPublish"]?

Edit: Oh, on the next line, I see :) Property indexing is not necessary when using it.

Edited, Apr 20, 2016 0:12