Disabled date later than today's date

17 posts, 0 answers
  1. bhavin patel
    bhavin patel avatar
    24 posts
    Member since:
    Jun 2005

    Posted 17 Nov 2009 Link to this post

    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.
  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 19 Nov 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. bhavin patel
    bhavin patel avatar
    24 posts
    Member since:
    Jun 2005

    Posted 20 Nov 2009 Link to this post

    RadDatePicker
  5. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 25 Nov 2009 Link to this post

    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.
  6. Santosh kumar
    Santosh kumar avatar
    14 posts
    Member since:
    Dec 2009

    Posted 13 Sep 2010 Link to this post

    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
  7. Pana
    Admin
    Pana avatar
    748 posts

    Posted 17 Sep 2010 Link to this post

    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
  8. Santosh kumar
    Santosh kumar avatar
    14 posts
    Member since:
    Dec 2009

    Posted 17 Sep 2010 Link to this post

    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.
  9. Pana
    Admin
    Pana avatar
    748 posts

    Posted 17 Sep 2010 Link to this post

    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
  10. Santosh kumar
    Santosh kumar avatar
    14 posts
    Member since:
    Dec 2009

    Posted 17 Sep 2010 Link to this post

    thanks it worked.
  11. Priyalakshmi
    Priyalakshmi avatar
    12 posts
    Member since:
    Jul 2012

    Posted 13 Jul 2012 Link to this post

    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
  12. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 17 Jul 2012 Link to this post

    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.

  13. Priyalakshmi
    Priyalakshmi avatar
    12 posts
    Member since:
    Jul 2012

    Posted 20 Jul 2012 Link to this post

    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.
  14. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 20 Jul 2012 Link to this post

    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.

  15. Christian
    Christian avatar
    52 posts
    Member since:
    Apr 2011

    Posted 26 Oct 2012 Link to this post

    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
  16. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 26 Oct 2012 Link to this post

    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.

  17. Aashu
    Aashu avatar
    1 posts
    Member since:
    May 2013

    Posted 15 May 2013 Link to this post

    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;

  18. diana
    diana avatar
    1 posts
    Member since:
    Sep 2014

    Posted 06 Sep 2014 in reply to Vladi Link to this post

    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?
Back to Top
UI for WPF is Visual Studio 2017 Ready