Rank: Member
Joined: 11/24/2010 Posts: 6 Points: 18 Location: Pune
|
Hi ,
We are using EntreeFormItem for holding value of Owner field which is type of "Person or Group" field.
EntreeFormItem owner = group.AddFormItem("PrimaryOwner", lstRecomm.Fields["Owner"]);
we are able to access the value of postback but we required to assign the same value to owner for it we are using following code but not able to get value if ( EntreeScope.FormProperties.ContainsKey("PrimaryOwner_Text") ) { owner.Value = EntreeScope.FormProperties["PrimaryOwner_Text"].ToString(); }
|
 Rank: ME Staff
Joined: 1/12/2009 Posts: 279 Points: 408 Location: VA
|
User fields are a bit different when it comes to their functionality. First, you need to cast the FormItem as an EntreePeoplePicker, then you will have access to the properties that set the value, like this:
EntreePeoplePicker psn = lGrp.AddFormItem("psn", list.Fields["psn"]) as EntreePeoplePicker; psn.SelectedText = "User Name"; psn.SelectedValue = "UserID";
The next step is to define the method that is used when a user is searching for a person. This control employs the ActiveUpdate AJAX method whenever someone starts typing in a name, this is the method you add:
public override void ActiveUpdate(EntreeScopeObject EntreeScope, EntreeListItemCollection output) { EntreeListItemAutoPostItems ais = output.AddListItem<EntreeListItemAutoPostItems>(); AutoPostItem ai = new AutoPostItem(); ai.Text = "You Searched for : " + EntreeScope.FormProperties["psn_Text"]; ai.Value = "User ID"; ais.ClickTarget = EntreeScope.Properties["AutoPostTarget"]; ais.Items.Add(ai); }
You will need to add the actual people search functionality in the ActiveUpdate method. This is just an example of how it is used.
|