Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a RadTimePicker and i have start time and end time.I have to compare if start is greater than the end time or not.I am using WPF with MVVM.

XML
<telerik:RadTimePicker  HorizontalAlignment="Center"
                                                             VerticalAlignment="Center" Height="Auto" Width="Auto"
                                                             DisplayFormat="Long"  removed="LightYellow" SelectedValue="{Binding PeriodSelected.StartTime.Time}"
                                                             FontSize="12"/>


SQL
<telerik:RadTimePicker  HorizontalAlignment="Center"
                                                              VerticalAlignment="Center" Height="Auto" Width="Auto"
                                                              DisplayFormat="Long"  Background="LightYellow"
                                                              SelectedValue="{Binding PeriodSelected.EndTime.Time}"
                                                              FontSize="12"/>



C#
public EP_TimeBase StartTime
     {
         get
         {
             return _startTime;
         }
         set
         {
             _startTime = value;
             RaisePropertyChanged("StartTime");
         }
     }

     private EP_TimeBase _endTime;
     public EP_TimeBase EndTime
     {
         get
         {
             return _endTime;
         }
         set
         {
             _endTime = value;
             RaisePropertyChanged("EndTime");
         }
     }
Posted
Updated 28-Apr-15 0:29am
v2

1 solution

Use ComapareValidator -
<asp:comparevalidator id="CompareValidator1" operator="GreaterThan" controltovalidate="RadDatePicker2" controltocompare="RadDatePicker1" errormessage="EndDate must be greater than StartDate" xmlns:asp="#unknown"></asp:comparevalidator>
 
Share this answer
 
Comments
Nikunj Bhanushali 30-Apr-15 2:34am    
We can use compare validator and set the type to compate to "Date" and use Operator "GreaterThan". This will perform the necessary valiation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900