Thread: CompareValidate
View Single Post
Old Dec 7th, 2005, 12:40 PM   #1
Ghost
Man Bear Pig Hunter
 
Ghost's Avatar
 
Join Date: Jul 2005
Location: NorCal, USA
Posts: 292
Rep Power: 4 Ghost is on a distinguished road
CompareValidate

I'm trying to compare two dates that I have to ensure that 1 is not before the other. Here is some code I have.

<table>
<tr>
<td width="150">
     <div align="right">Proposal Date From:</div>
</td>
<td colSpan="2">
     <cc1:popupcalendar id="PopupCalendarProposalDateFrom" 
          runat="server" 
          ButtonPosition="outside"
          DefaultTodaySel="False">
</cc1:popupcalendar>
<br>
To:
<cc1:popupcalendar id="PopupCalendarProposalDateTo" 
     runat="server" 
     ButtonPosition="outside" 
     DefaultTodaySel="False"
     ButtonOffsetX="-1" 
     ButtonOffsetY="-1">
</cc1:popupcalendar>
					
<asp:CompareValidator id="CompareValidatorFromTo" 
     runat="server" 
     CssClass="ErrorLabelIcon" 
     Width="12px"
     ErrorMessage="The 'Proposal Date From' must be before 'To'"
     Display="None" 
     ForeColor="Red" 
     Operator="GreaterThanEqual"
     Type="Date" 
     ControlToCompare="PopupCalendarProposalDateTo"     
     ControlToValidate="PopupCalendarProposalDateFrom"		         
     EnableClientScript="False">
</asp:CompareValidator>

<asp:CompareValidator id="CompareValidatorFromToIcon" 
     runat="server" 
     CssClass="ErrorLabelIcon" 
     Display="Dynamic"
     ForeColor="Red" 
     Operator="GreaterThanEqual" 
     Type="Date" 
     ControlToCompare="PopupCalendarProposalDateTo"
     ControlToValidate="PopupCalendarProposalDateFrom"
     EnableClientScript="False">
</asp:CompareValidator>
</td>
</tr>
</table>

Everything returns an error. The PopupCalendar control I have returns dates in "MM/DD/YYYY" Format (12/07/2005)

Any help would be great, thanks.
Ghost is offline   Reply With Quote