
Using SharePoint Controls
❘
51
FIGURE218: Using the SharePoint tag within the user control mark-up
For example purposes, use a ListViewByQuery control along with a date picker provided by the
DateTimeControl. The markup looks like the following.
<SharePoint:ListViewByQuery runat=”server” ID=”CustomListView” />
<br />
<asp:Label ID=”DateLabel” runat=”server” Text=”Expected Completion:” />
<SharePoint:DateTimeControl ID=”CompletionDate” AutoPostBack=”true”
OnDateChanged=”CompletionDate_Changed” DateOnly=”true” runat=”server” />
This provides a way to view a list based on a date selection. Make sure the list you use for this
example contains a date column. The label prompts the user for the date. The
DateTimeControl
renders a date picker for the user to select a date. The
OnDateChanged parameter references a code-
behind method that needs to be created.
In the code-behind, you rst need to add
using statements for Microsoft.SharePoint, Microsoft.
SharePoint.Utilities, and System.Web. These assemblies should already be referenced within the proj-
ect. Add the
using statements at the top along w