Add assembly directive in custom application page
<(add percentage)@ Register TagPrefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"(add percentage)>
Here is the control
ValidatorEnabled="true" ID="Appsperson" runat="server" ShowCreateButtonInActiveDirectoryAccountCreationMode="true"
SelectionSet="User" Visible="true" />
Here is the code for loading control on page load event
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SPSite oSiteCollection = SPContext.Current.Site;
SPWeb spCurrentWeb = oSiteCollection.OpenWeb();
using (SPSite site = new SPSite(spCurrentWeb.Url))
{
site.AllowUnsafeUpdates = true;
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
list = web.Lists["listname"];
string ItemId = Request.QueryString["ItemId"];
SPListItem item = list.GetItemById(Convert.ToInt32(ItemId));
if (item["EditContact"] != null) // Editcontact is column name
{
Appsperson.CommaSeparatedAccounts = LoadPeopleEditor("EditContact", item);
}
}
}
}
}
private string LoadPeopleEditor(string fieldName, SPListItem spListItem)
{
string peopleEditorValue = string.Empty;
SPFieldUserValueCollection spFieldUserValueCollection = (SPFieldUserValueCollection)spListItem[fieldName];
foreach (SPFieldUserValue spFieldUserValue in spFieldUserValueCollection)
{
if (spFieldUserValue != null)
{
string lookUpVal = string.Empty;
if (spFieldUserValue.User != null)
lookUpVal = spFieldUserValue.User.LoginName;
else
lookUpVal = spFieldUserValue.LookupValue;
peopleEditorValue += lookUpVal;
peopleEditorValue += ",";
}
}
peopleEditorValue = peopleEditorValue.Substring(0, peopleEditorValue.Length - 1);
return peopleEditorValue;
}