DatePicker textbox doesn't honor non-selectable days in calendar

2 posts, 0 answers
  1. Chris
    Chris avatar
    5 posts
    Member since:
    Jan 2008

    Posted 03 Jan 2008 Link to this post

    I suppose this is an enhancement suggestion:

    The special days feature of the calendar allows you to prevent the user from selecting certain days.  It would be very helpful if the textbox in the date picker were to disallow dates that are non-selectable in the child calendar.

    Short of adding that feature, is there a code sample of how to query the special days client side for use in validating the text box?

    Thanks,
    Chris Beck
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 04 Jan 2008 Link to this post

    Hi Chris,

    There is no exposed public API for this but you could use the specialDaysArray property of the calendar control to extract the necessary information:
    <telerik:RadCalendar ID="RadCalendar1" runat="server"
        <SpecialDays> 
            <telerik:RadCalendarDay Date="2008/1/4" /> 
            <telerik:RadCalendarDay Date="2008/1/5" /> 
        </SpecialDays> 
    </telerik:RadCalendar> 
     
    <script type="text/javascript"
    function pageLoad() 
        var calendar = $find("RadCalendar1"); 
        var specialDays = calendar.get_specialDaysArray(); 
        for (var i=0; i < specialDays.length; i++) 
        { 
            var specialDay = specialDays[i]; 
             
            // this is the date triplet [year, month, day] that can be converted into a JavaScript Date 
            var dateTriplet = specialDay[1]; 
            var jsDate = new Date(dateTriplet[0], (dateTriplet[1] - 1), dateTriplet[2]); 
            alert(jsDate); 
        } 
    </script> 

    We have logged your feedback on the disabling dates in the input control as well.



    Regards,
    Manuel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top