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

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

1 Answer 67 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 03 Jan 2008, 05:57 PM
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

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 04 Jan 2008, 03:22 PM
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
Tags
Calendar
Asked by
Chris
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or