Sunday, March 14, 2010
Date Time Control In Sharepoint
<%@ Register TagPrefix="SharePointSD" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
<div>
<table>
<tr>
<td style="width: 100px">
Start Date</td>
<td style="width: 100px">
<SharePointSD:DateTimeControl runat="server" ID="dteDemo1" DateOnly="True">
<asp:TextBox runat="server" MaxLength="45" CssClass="ms-input" ID="dtpDateTimeIdentifierTextBox1">
</asp:TextBox>
</SharePointSD:DateTimeControl>
</td>
<td style="width: 100px">
End Date</td>
<td style="width: 100px">
<SharePointSD:DateTimeControl runat="server" ID="dteDemo2" DateOnly="True">
<asp:TextBox runat="server" MaxLength="45" CssClass="ms-input" ID="dtpDateTimeIdentifierTextBox2">
</asp:TextBox>
</SharePointSD:DateTimeControl>
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td colspan="3">
<asp:CompareValidator id="cv" runat="server" ForeColor="red" Type="date" Operator="GreaterThan" ErrorMessage="End Date shoule be greater than start date"
ControlToCompare="dteDemo1$dteDemo1Date" ControlToValidate="dteDemo2$dteDemo2Date" ></asp:CompareValidator></td>
</tr>
</table>
</div>