SPField.DefaultValue Property
Gets or sets the default value for a field.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
SPFieldLookup Datasheet View Bug
There are some compatibility issues when editing Lookup Columns in Datasheet view after setting the DefaultValue property.
See this article for details and a workaround: http://rrfreeman.blogspot.com/2012/03/sharepoint-lookup-column-defaultvalue.html
- 4/3/2012
- RobertRFreeman
Set Default Value
To add a default value of today's date you need to assign "[today]" to this property. Yip. the string "[today"]. In other cases you need to convert a DateTime to string like so:
DateTime defaultValue = DateTime.Today.ToString("u");
- 11/30/2011
- moontear