Thursday, April 23, 2009

Add People Picker and Date Time Control

Issue: Add WSS DateTimeControl to a custom application page.
Solution: Firstly include below tag for SharePoint assembly in the application page on top.

<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

DateTimeControl Tag:

<wssawc:DateTimeControl ID="DemoControl1" runat="server" DateOnly="true"></wssawc:DateTimeControl>

People Picker Control Tag:

<wssawc:PeopleEditor ID="OSAccountContact" runat="server" MultiSelect="False" SharePointGroup="OS Global Delivery India" ValidatorEnabled ="true" />

Similarly,you can add other SharePoint Control also in custom application pages.
Note: The PeopleEditor Control will give object reference error when run in aspx pages. Also the DateTimeControl will not show error in aspx page but will not show calendar control for picking the date. You need to add it as a user control or webpart into a sharepoint site to test it and use it.




No comments:

Post a Comment