Get value from People Editor Control?

missReclusive picture missReclusive · Feb 21, 2012 · Viewed 20.1k times · Source

I have created a visual WebPart contains a people Editor control to pick the Manager Name(infact only one name). The control is working fine but i would like to store the particular value to a variable using code during the button click . how can i achive this ? any help?

Answer

Rony SP picture Rony SP · Feb 22, 2012

Hope this code is helpful for you..

public void btnSave_Click(object sender, System.EventArgs e)
{
   ….
   //where userPicker is Id of People picker control
   PickerEntity pe = (PickerEntity)userPicker.Entities[0];  
   string username = pe.Description;
   …
}