Export (0) Print
Expand All

BaseFieldControl.ItemFieldValue property

Gets or sets the value of the SPField that has this BaseFieldControl as its FieldRenderingControl property.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public virtual Object ItemFieldValue { get; set; }

Property value

Type: System.Object
A Object that represents the value of the SPField object that has the BaseFieldControl as its FieldRenderingControl property.

If the field is being rendered on a New item form and ItemFieldValue has not yet been set, the default value for the field type is returned.

Value is the value of the visible field in the UI, while ItemFieldValue is the value of the field for the SPField that has the BaseFieldControl as its FieldRenderingControl property.

When the BaseFieldControl first loads and when it reloads after a postback, Value is given the same value as ItemFieldValue. If the field has never been set for the current list item, ItemFieldValue is a default value for the field type.

Notes to inheritors

If the value of the field is to be changeable by users, your logic should change Value directly and then call UpdateFieldValueInItem, which will set ItemFieldValue to match Value and ensure that the appropriate value-changed event occurs. Neither UpdateFieldValueInItem nor the set accessor of ItemFieldValue directly performs any validation of the data. Consider calling Validate after setting Value and then checking the value of IsValid (which should be set by Validate) before the call to UpdateFieldValueInItem.

Community Additions

Show:
© 2014 Microsoft