Wednesday, 28 August 2013

Validate two dates from and to

Validate two dates from and to

If i have two date time picker like that :
<telerik:RadDateTimePicker ID="dtp_from" runat="server">
<TimePopupButton ImageUrl=""
HoverImageUrl=""></TimePopupButton>
<TimeView CellSpacing="-1" Culture="Arabic
(Egypt)">
</TimeView>
<Calendar UseRowHeadersAsSelectors="False"
UseColumnHeadersAsSelectors="False">
</Calendar>
<DateInput DisplayDateFormat="dd/MM/yyyy"
DateFormat="dd/MM/yyyy" LabelWidth="40%">
</DateInput>
<DatePopupButton ImageUrl=""
HoverImageUrl=""></DatePopupButton>
</telerik:RadDateTimePicker>



<telerik:RadDateTimePicker ID="dtp_to" runat="server">
<TimePopupButton ImageUrl=""
HoverImageUrl=""></TimePopupButton>
<TimeView CellSpacing="-1" Culture="Arabic
(Egypt)">
</TimeView>
<Calendar UseRowHeadersAsSelectors="False"
UseColumnHeadersAsSelectors="False">
</Calendar>
<DateInput DisplayDateFormat="dd/MM/yyyy"
DateFormat="dd/MM/yyyy" LabelWidth="40%">
</DateInput>
<DatePopupButton ImageUrl=""
HoverImageUrl=""></DatePopupButton>
</telerik:RadDateTimePicker>



and i want to validate that :
1- dtp_from > today and dtp_to > dtp_from client side and server side
when i put
<asp:CompareValidator ID="cv_from_date" runat="server" ErrorMessage="*"
ControlToValidate="dtp_to"
Display="Dynamic" Operator="GreaterThanEqual"
Type="Date" ControlToCompare="dtp_from"
ValidationGroup="G1"></asp:CompareValidator>
it doesn't allow me to insert although the the dtp_to > dtp_from !!

No comments:

Post a Comment