Need to assign current logged in USER name to the people picker control in ASPX page
Hi All
I need to assign the current user to the people picker control in my custom ASPX page which I am planing to host in sharepoint (WSS) .
I was trying on these lines but without success.
System.Collections.ArrayList entityArrayList = new System.Collections.ArrayList();
PickerEntity entity = new PickerEntity();
userPicker = new PeopleEditor();
userPicker.MultiSelect = false;
entity.Key = SPContext.Current.Web.CurrentUser.LoginName;
entity= userPicker.ValidateEntity(entity);
entityArrayList.Add(entity.Key);
userPicker.UpdateEntities(entityArrayList);
It is throwing type casting exception.did tried with all the rules of the book but nothing worked!
Please let me know if you have any idea to fix this issue .
Thanks in advance
Jagadish
|