This is a migrated thread and some comments may be shown as answers.

How to Set the range of the dates

4 Answers 167 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
balv
Top achievements
Rank 1
balv asked on 25 Sep 2010, 04:44 AM
Hi All
I want to Set the range of the dates the user will be able to navigate to, and a constraint on the dates that can be selected similar to RadCalendar.
For example is 01/01/1900 to 12/12/9999
Regards
balv

4 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 27 Sep 2010, 08:22 AM
Hello,

You need to set SelectableDateEnd and SelectableDateStart to the desired start and end dates. You can set them either in XAML or Code.

Let me know if you have further questions.

Best wishes,
Boyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
balv
Top achievements
Rank 1
answered on 27 Sep 2010, 05:08 PM
I use version Q2 2010 SP1 but I can not see these properties in RadDatePicker
0
balv
Top achievements
Rank 1
answered on 28 Sep 2010, 03:15 AM
I am sorry for error of omission. I found these properties and use it but  when I type 01/01/1000 and Click button to show selectedDate then has any error.
How to I prevent user choose or type invalid date(not between a range date)
thanks.

<UserControl xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"  x:Class="SilverlightApplication1.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
  
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="8*"/>            
        </Grid.RowDefinitions>
        <my:RadDatePicker x:Name="radDatep" 
                          SelectableDateStart="01/01/1975" 
                          SelectableDateEnd="01/01/3000" 
                          DisplayDateStart="01/01/1975" 
                          DisplayDateEnd="01/01/3000" 
                          Height="20" 
                          Width="100"/>
        <Button x:Name="btn" Content="Click" Grid.Row="1" Height="23" Width="75"></Button>
    </Grid>
</UserControl>
0
Accepted
Boyan
Telerik team
answered on 30 Sep 2010, 09:03 AM
Hello,

This is the way RadDateTimePicker work at the moment, the properties you have used restrict just the dates selected from the calendar. We decided to leave more space for customization and that is why we have not restricted the date parsing in such specific scenarios. However you can easily manipulate it with some code using the ParseDateTimeValue event. With it you can set the range for the parsing. You can take a look at this help article for more info. You can also create a custom message, for example "Date not in allowed range".

 Let me know if you have further questions.

All the best,
Boyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DatePicker
Asked by
balv
Top achievements
Rank 1
Answers by
Boyan
Telerik team
balv
Top achievements
Rank 1
Share this question
or