Compartilhar via


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)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Overridable Property ItemFieldValue As Object
    Get
    Set
'Usage
Dim instance As BaseFieldControl
Dim value As Object

value = instance.ItemFieldValue

instance.ItemFieldValue = value
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.

Remarks

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.

See Also

Reference

BaseFieldControl Class

BaseFieldControl Members

Microsoft.SharePoint.WebControls Namespace

Other Resources

How to: Create a Custom Field Type

Custom Field Types

Walkthrough: Creating a Custom Field Type