November Happy Hour will be moved to Thursday December 5th.

Creating a similar property as the builtin "modify updated date"

Vote:
 

Hi

I want to crete a property that works as the built in modify updated date checkbox i.e saving a DateTime value but rendering a dojo checkbox with all the fancy stuff.

Is there an easy way to do this in 7.5?

Thanks,
Christian

#91289
Oct 01, 2014 16:21
Vote:
 

The easiest way to accomplish this is to add a datetime and boolean property to your content model.

[Editable(false)]
public virtual DateTime MyDate {get; set;}

public virtual bool SetMyDate {get; set;}

Then implement event handlers using IContentEvent (or DataFactory) for PublishingContent (or possibly SavingContent) that set the value of MyDate to DateTime.Now if SetMyDate is true and then clears SetMyDate.

The Editable attribute should make you property visible in edit mode but read only.

#91418
Oct 03, 2014 23:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.