Posted on: 11/14/2011 10:15:50 PM | Views : 219

Hi all, I have a textbox to enter date. I want to ensure that the user only enters todays date or earlier. I have used a CompareValidator to try and achieve this (see below). However my CompareValidator only validates the day, it ignores the month and year i.e. todays date is the 15 November 2011 (15/11/2011). The validator accepts any date where the day is <= 15 (eg. 14/11/2011, 14/12/2011, 14/12/2012) and rejects any date where the day is > 15 (e.g. 16/11/2011, 16/11/2010, 16/10/2011), regardless of the month or year. Can anyone please help? Cheers, Damian
<%--DATE--%> <asp:Label ID="labDate" runat="server" Text="Date *" AssociatedControlID="txtDate" CssClass="faunalabels"></asp:Label> <asp:TextBox ID="txtDate" runat="server" CssClass="faunatext" ToolTip="dd/mm/yyyy"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat ...

Go to the complete details ...