Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Assign current logged in USER name to the people picker

  Asked By: Darius    Date: Apr 27    Category: Sharepoint    Views: 2410

I need to assign the current user to the people picker control in my 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!

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Janell Camacho     Answered On: Apr 27

If you can use Javascript you could go with javascript, I found this nifty blog
when i was up against the wall trying to do the same thing:
blogs.vbcity.com/.../9024.aspx

 
Didn't find what you were looking for? Find more on Assign current logged in USER name to the people picker Or get search suggestion and latest updates.




Tagged: