Welcome Guest Search | Active Topics | Members | Log In | Register

Problem with Person or Group Field Options
KamleshBelote
Posted: Friday, November 26, 2010 7:47:47 AM
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();
}
joe
Posted: Friday, November 26, 2010 9:49:05 AM

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.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.