About Me

My photo
a Dynamic and Energetic guy.....

Thursday, June 23, 2011

SharePoint 2010 People Picker Programatically

PeopleEditor peoplePick = new PeopleEditor();

        protected override void CreateChildControls()
        {
           
            peoplePick.AllowEmpty = false;
            peoplePick.AllowTypeIn = true;
            peoplePick.BrowseButtonImageName = "Search";
            peoplePick.CheckButtonImageName = "Validate User";
            peoplePick.ErrorMessage = "No Names Found";
            tdPeoplePicker.Controls.Add(peoplePick);
            //this.Controls.Add(peoplePick);
            base.CreateChildControls();
        }

    protected void btnSave_Click(object sender, EventArgs e)
        {           
            foreach (string ent in peoplePick.CommaSeparatedAccounts.Split(','))
            {
                if (ent.Length > 0)
                {
                    PeerReviewGroup_Employee objPeerEmp = new PeerReviewGroup_Employee();
                    objPeerEmp.EmpID = Utility.GetNullableInt(GetSelectedUserIDsByName(ent));
                    objPeerEmp.GroupID = int.Parse(ddlPeerGroup.SelectedValue);

                    PeerReviewGroup_EmployeeService.Save(objPeerEmp);
                }
            }
           
        }

No comments:

My Masters