MinDate - hide nav arrows - date is out of range

2 posts, 0 answers
  1. Peter
    Peter avatar
    98 posts
    Member since:
    Mar 2012

    Posted 03 Mar 2013 Link to this post

    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?
  2. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 07 Mar 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top