HTML Code
<SharePoint:PeopleEditor ID="pplControl" runat="server" Rows="1" PlaceButtonsUnderEntityEditor="false" Width="250px" SelectionSet="User" />Function to get the User display name from the people picker:
public string GetSPUserDisplayName(SPWeb objSPWeb, PeopleEditor pplControl)
{
try
{
string userValue = string.Empty;
if (pplControl.Entities.Count > 0)
{
PickerEntity pplAssigned = (PickerEntity)pplControl.Entities[0];
SPUser webUser = objSPWeb.EnsureUser(pplAssigned.Key);
userValue = webUser.Name;
}
return userValue;
}
catch (Exception ex)
{
// Log Exception
}
}Calling the function
string userDisName = GetSPUserDisplayName(web, peoplePickerControl);