Add
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
in the page.
<SharePoint:PeopleEditor ID="spPeoplePickerUserName" Width="200" runat="server" SelectionSet="User" AllowEmpty="true" MultiSelect="false" AutoPostBack="false" />
to store the data use
if (spPeoplePickerRespUser.ResolvedEntities.Count > 0)
{
PickerEntity selectedEntity = (PickerEntity)spPeoplePickerRespUser.ResolvedEntities[0];
SPUser user = oWeb.EnsureUser(selectedEntity.Key);
itemToAdd["Entered_x0020_By"] = user;
}
for edit mode,
spPeoplePickerUserName.CommaSeparatedAccounts = Convert.ToString(itemToUpdate["User_x0020_Name"]);
if (spPeoplePickerUserName.ResolvedEntities.Count > 0)
{
PickerEntity entity = (PickerEntity)spPeoplePickerUserName.ResolvedEntities[0];
accountName = entity.Key;
int pos = accountName.IndexOf('\\');
accountName = accountName.Substring(pos + 1);
SetContactInformation(accountName);
}
No comments:
Post a Comment