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

Disabled date later than today's date

16 Answers 2637 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Bhavin
Top achievements
Rank 1
Bhavin asked on 17 Nov 2009, 09:33 PM
I am using dateTimePicker I want to disabled the dates later than from today's date and I want to show a kind of label showing today's date all the time inside the datetimepicker control  so that when user is navigating to other dates/months/years,today's date would be visible all the time.

16 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 19 Nov 2009, 02:44 PM
Hello bhavin patel,

Can you specify which is the exact control you are using - RadDatePicker or DateTimePicker.

All the best,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Bhavin
Top achievements
Rank 1
answered on 20 Nov 2009, 05:43 PM
RadDatePicker
0
Kaloyan
Telerik team
answered on 25 Nov 2009, 12:34 PM
Hi bhavin patel,

Try this code radDatePicker.SelectableDateStart = DateTime.Now. It will help you to prevent selecting a date before the current  date. Also you can put a TextBlock control above the RadDatePicker, that will display a current date. Let us know it this is not helping you.

Sincerely yours,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Santosh kumar
Top achievements
Rank 1
answered on 14 Sep 2010, 03:41 AM
Hi,

we have version 2010.1.603.35. I was looking for how to disable dates for date validation and found this thread, which is exactly what i was looking for. But the dates which are disabled are not very clear, i mean they look as if they are not disabled. How to change the opacity of the disabled dates?

Thanks
Santosh
0
Pana
Telerik team
answered on 17 Sep 2010, 06:46 AM
Hi Santosh,

You can make the dates more 'invisible' by decreasing the opacity in the trigger that modifies the look for the IsEnabled="false". I have put a comment in the xaml to show you where the changes in the templates are. The opacity was decreased from .75 to .25.

Best wishes,
Panayot
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
Santosh kumar
Top achievements
Rank 1
answered on 17 Sep 2010, 09:46 AM
sample project is not working. I mean, even if i set the opacity to lowest visually there is no difference between enabled and disabled dates.
0
Pana
Telerik team
answered on 17 Sep 2010, 09:56 AM
Hi Santosh,

Perhaps I have used the old 2009.3.1103 version of the dlls for the example. You can check the currently attached project if it will work with your dlls. I am sorry for the inconvenience.

Kind regards,
Panayot
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
Santosh kumar
Top achievements
Rank 1
answered on 17 Sep 2010, 10:07 AM
thanks it worked.
0
Priyalakshmi
Top achievements
Rank 1
answered on 13 Jul 2012, 12:25 PM
Hi,
I have a RAD Date picker(version 2011.2.915.35) on my web page. I don't want the users to select  a future date from that,i.e. if the current date is 13 July 2012, I don't want the users to select 14 July 2012 from that. So how to disable the dates in this control that are greater than the current date.

Thank you
Priya
0
Vladi
Telerik team
answered on 17 Jul 2012, 02:31 PM
Hello Priya,

To disable the days after the current day in RadDateTimePicker all you need is to set the SelectableDateEnd property. You can set it like this:

RadDateTimePicker theDateTimePicker = new RadDateTimePicker();
theDateTimePicker.SelectableDateEnd = DateTime.Today;

Hope this helps.

Regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Priyalakshmi
Top achievements
Rank 1
answered on 20 Jul 2012, 06:01 AM
Thanks for the support. I used the max date property of the date time picker to make this work. Its working properly as desired.
What is the difference between the max date property and selected end date property of RAD date picker control? Isn't both fulfilling the same purpose?? I am now confused.
0
Vladi
Telerik team
answered on 20 Jul 2012, 08:43 AM
Hi,

I am not sure exactly which property you are referring to. Can you explain which property name you are using?

Kind regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Christian
Top achievements
Rank 1
answered on 26 Oct 2012, 08:13 AM
When I set SelectableDateStart or DisplayDateStart I can still type in Dates earlier than SelectableDateStart /DisplayDateStart.
I would expect that this is prevented by the control
0
Vladi
Telerik team
answered on 26 Oct 2012, 09:05 AM
Hello Christian,

This is not a built-in feature in the control but it could be implemented easily. You could use the ParseDateTimeValue event in which add a condition to check if the input data is before or after the SelectableDateStart/SelectableDateEnd values.

The next code snippet shows the described approach:
In the xaml:
<telerik:RadDatePicker SelectableDateStart="10/26/2012"
                        SelectableDateEnd="10/30/2012"
                        ParseDateTimeValue="cmbDatePicker_ParseDateTimeValue_1"/>

and in the code behind:
private void cmbDatePicker_ParseDateTimeValue_1(object sender, ParseDateTimeEventArgs args)
{
    var datePicker = sender as RadDatePicker;
    if (datePicker.SelectedValue < datePicker.SelectableDateStart || datePicker.SelectedValue > datePicker.SelectableDateEnd)
    {
        // your custom logic here for example set the SelectedValue to null
        datePicker.SelectedValue = null;
    }
}

Hope this helps.

Kind regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Aashu
Top achievements
Rank 1
answered on 15 May 2013, 09:26 AM

Yes to validate DateTimePicker According to Today's date is possible as follows:
DateTimePicker dateTimePicker = new DateTimePicker();
1. For dates more than today

    dateTimePicker.MinDate = DateTime.Today;
2. For dates less than today

    dateTimePicker.MaxDate = DateTime.Today;

0
diana
Top achievements
Rank 1
answered on 06 Sep 2014, 09:32 AM
Hi
Im using simplecalendar.js and I want to diable the dates before present date and enable from todays date till the next 15 days only...how can I do that?
Tags
DatePicker
Asked by
Bhavin
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Bhavin
Top achievements
Rank 1
Santosh kumar
Top achievements
Rank 1
Pana
Telerik team
Priyalakshmi
Top achievements
Rank 1
Vladi
Telerik team
Christian
Top achievements
Rank 1
Aashu
Top achievements
Rank 1
diana
Top achievements
Rank 1
Share this question
or