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

MinDate - hide nav arrows - date is out of range

1 Answer 49 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 04 Mar 2013, 04:21 AM
When you set a MinDate on a RadDatePicker, the Calendar's arrows are hidden to prevent straying into the wrong month... however in the Calendar, the arrows aren't hidden and instead I get a JavaScript alert:

---------------------------
Message from webpage
---------------------------
Date is out of range.
---------------------------
OK   
---------------------------

How do I hide the arrows?

1 Answer, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 07 Mar 2013, 07:24 AM
Hi Richard,

Note that setting the RadDatePicker.MinDate and Calendar.RangeMinDate have the same effect on the functionality. However, if you want to hide the arrows you could achieve your scenario by using the code provided below which hides the prev and fast prev arrows.
<telerik:RadCalendar ID="RadCalendar1" runat="server" RangeMinDate="03/07/2013">
    <ClientEvents OnCalendarViewChanged="CalendarViewChanged" />
</telerik:RadCalendar>
<telerik:RadScriptBlock runat="server">
    <script type="text/javascript">
        var calendar;
        function pageLoad()
        {
            calendar = $find("<%= RadCalendar1.ClientID %>");
            updateIconsVisibility();
        }
        function CalendarViewChanged(sender, args)
        {
            updateIconsVisibility();
        }
 
        function updateIconsVisibility()
        {
            var display = "visible";
            if (calendar.get_rangeMinDate()[1] == calendar.get_focusedDate()[1])
            {
                display = "hidden";
            }
            $telerik.getElementByClassName(calendar.get_element(), "rcPrev").style.visibility = display;
            $telerik.getElementByClassName(calendar.get_element(), "rcFastPrev").style.visibility = display;
        }
    </script>
</telerik:RadScriptBlock>

Kind regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Calendar
Asked by
Peter
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Share this question
or