I'm Trying to create a new formulary in a new Asp page on my sharepoint site.
So i need a field that can search all users and select one.
I Saw on several forums that the best controls are PeoplePicker or PeopleEditor.
Now I have to get the value from the control and instert it to a list...
Is Javascript the only way to do that? I can't see any good options in the properties...
In my aspx code, I tried to put a userfield control but the page doesn't show it...same for peoplepickerdialog
here's my code:
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
User: <SharePoint:PeopleEditor runat="server" ID="UserPe" /><br />
Start Date: <SharePoint:DateTimeControl runat="server" ID="StartDate" DateOnly="true" /><br />
End Date: <SharePoint:DateTimeControl runat="server" ID="EndDate" DateOnly="true" /><br />
Comment: <asp:TextBox runat="server" ID="CommentTb" TextMode="MultiLine" /><br />
<asp:Button runat="server" ID="SubmitBtn" Text="Submit" OnClick="SubmitBtn_Click" />
<asp:Button runat="server" ID="CancelBtn" Text="Cancel" OnClick="CancelBtn_Click" />
</asp:Content>
and here's the code behind
protected void SubmitBtn_Click(object sender, EventArgs e)
{
SPList thisList = SPContext.Current.Web.Lists["Recuperations"];
SPListItem newItem = thisList.Items.Add();
newItem["User"] = GetUser();
newItem["Start Date"] = StartDate.SelectedDate.Date;
newItem["End Date"] = EndDate.SelectedDate.Date;
newItem["Comment"] = CommentTb.Text;
newItem.Update();
Context.Response.Redirect(SPContext.Current.Web.Url);
}
The GetUser()
just return an SPUser
...it should be working...or not...