Loading...

Thursday, August 4, 2011

A Method To Get Selected Value in spuc:PeopleEditor control (Quickly)

-- Add Control in ascx


AllowEmpty="true" MultiSelect="false" SelectionSet="User" />
 
-- Get User value in ascx.cs
public SPUser GetUser(PeopleEditor p)

{

PickerEntity entPropMgr = (PickerEntity)p.ResolvedEntities[0];

SPFieldUserValue Proposalmgrvalue = new SPFieldUserValue(SPContext.Current.Web, Convert.ToInt16(entPropMgr.EntityData[PeopleEditorEntityDataKeys.UserId]), entPropMgr.Description);

if (Proposalmgrvalue != null)

return Proposalmgrvalue.User;

else

return SPContext.Current.Web.CurrentUser;



}

No comments: