Using PeopleEditor as a Template Field
Hi!
When a customer of mine wanted a web part and described how it was supposed to work, there was a need to use the PeopleEditor class and use it insida a template field in a SPGridView. There are a lot of ways to accomplish the following task, but I choose to use a DataTable as the datasource for the gridview.
The SPGridview has four columns, a generated edit-column and three template fields. One of the template fields consists of a Literal control when displaying the item and a PeopleEditor when in editing the item. The problem was to set the default value of the PeopleEditor to a value that resides at a specific location in a specific list. The value in the list is of the type Person.
Trying to use the PeopleEditor.Accounts.Add() methos did not work and after closely looking the the SDK for the PeopleEditor class, there can be seen that the method CommaSeperatedAccounts property could be set. And after putting the value from the list (the Person column) into the PeopleEditor.CommaSeperatedAccount property the template field was showing the default value from the item view in the edit view of the SPGridview.
The documentation of the PeopleEditor is very shortcoming and perhaps this will be of some use to someone.
//Sebastian

