I've created field type inherited SPFieldUser with custom rendering control. My problem is: this field doesn't save value if it was provisioned by content type. When I add this field directly in list definition or in list through UI everything fine.
Key point in field implementation is overriding Value function.
public override object Value
{
get
{
this.EnsureChildControls();
var userId = this.UserIdControl.Text;
SPFieldUserValue res = new SPFieldUserValue();
if (!string.IsNullOrEmpty(userId))
{
var userIdArr = userId.Split('|');
var userIdInt = int.Parse(userIdArr[0]);
var userLogon = userIdArr[1];
res = new SPFieldUserValue(SPContext.Current.Web, userIdInt, userLogon);
}
return res;
}
set
{
this.EnsureChildControls();
base.Value = value;
}
}
This function is called in both situations (Note: User always exists, it never could be null in my code example): when field added by content type and by me, but in first case value doesn't saved.
Could someone help me?