Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UserField - Problem with SPControlMode.Edit

Status
Not open for further replies.

sarah310

Programmer
May 31, 2007
1
Hi guys,

I used the UserField-Control in my webpart. If I create a new listitem, the userfield-value gets saved into the SPList. But there's a Problem, when there is a listitem: the control is shown on screen with the right value, but on updating the Control the value gets null (even in the SPList) and after clicking the check-name-button the screenshot appears (picture here
Create-Code:
Code:
UserField bf = new UserField();
bf.ID = bf;
bf.ListId = //is set
bf.FieldName = //is set
if (/*listItem is != null*/)
{  bf.ControlMode = SPControlMode.Edit;
   bf.ItemId = //is set}
else
{ bf.ControlMode = SPControlMode.New;}

Update-Code:
Code:
UserField bf = (UserField)editTable.FindControl("bf");
if ((bf != null))
{ listItem[user.Id] = bf.Value;}

Is there anybody out there who knows how to save the Edit-Value?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top