Wednesday, July 25, 2012

PeoplePicker Visual Webpart

<table>
<tr>
<td>
<SharePoint:PeopleEditor ID="PeoplePicker" runat="server" Width="300" MultiSelect="false"  BorderStyle="Solid" BorderColor="Black" BorderWidth="1" />
</td>
</tr>
<tr>
<td>
<SharePoint:PeopleEditor ID="PeopleEditor1" runat="server" Width="300" MultiSelect="True"  BorderStyle="Solid" BorderColor="Black" BorderWidth="1" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnDisplay" runat="server" Text="Display" OnClick="btnDisplay_Click"/>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbltext" runat="server"></asp:Label>
</td>
</tr>
</table>

protected void btnDisplay_Click(object sender, EventArgs e)
        {
            string str = string.Empty;
            for (int index = 0; index <= PeopleEditor1.ResolvedEntities.Count - 1; ++index)
            {

                PickerEntity objEntity = (PickerEntity)PeopleEditor1.ResolvedEntities[index];

                str += "SPUser" + objEntity.EntityData["SPUserID"] + " SPKEy" + objEntity.Key + "\n";

            }
            lbltext.Text = str;
            //Response.Write(str);


        }


No comments:

Post a Comment