Compartilhar via


UserField.Value Property

Gets or sets the status of the value of the UserField control in the UI.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Overrides Property Value As Object
    Get
    Set
'Usage
Dim instance As UserField
Dim value As Object

value = instance.Value

instance.Value = value
public override Object Value { get; set; }

Property Value

Type: System.Object
A String (cast to Object) that represents the value of the UserField control in the UI, which is not necessarily its value in the Windows SharePoint Services 3.0 database until UpdateFieldValueInItem is called. The String has the following form.
User_or_Group_ID;#User_or_Group_Name[;#User_or_Group_ID;#User_or_Group_Name ...]
The User_or_Group_ID is the ID number of the user or group on the site. The User_or_Group_Name is the name of the user or group. An example of this kind of String is 145;#BobR;#11;#Sally.

Remarks

You can set Value with a String with the form described in the Return Value section or with either an SPFieldUserValue or SPFieldUserValueCollection object.

To keep the UI of the control consistent with the actual value of the field, Value should be set initially with the value of

ItemFieldValue (which is the actual value of the SPFieldUser control that has UserField as its FieldRenderingControl property). The default OnLoad method does this.

Whenever your code sets Value, it should immediately call UpdateFieldValueInItem to update ItemFieldValue. This ensures that the appropriate value-changed event occurs.

See Also

Reference

UserField Class

UserField Members

Microsoft.SharePoint.WebControls Namespace