I used an approach described here: http://developer.dynamicweb.com/forum/development/default-value-for-itemfield.aspx to do the following code:
[Field("Active From", typeof(Dynamicweb.Content.Items.Editors.DateTimeEditor))]
[DefaultValue("NOW")]
[Required]
public DateTime Active_From { get; set; }
[Field("Active To", typeof(Dynamicweb.Content.Items.Editors.DateTimeEditor))]
[DefaultValue("NOW")]
[Required]
public DateTime Active_To { get; set; }
The default value is inserted into the item. However, I receive an SQL-error when I try adding a new item:
http://screencast.com/t/aSgwSdRM6aD
It seems that there's no default value when I try creating a new item.
Regards,
Peter