Disbale DatePicker Disable SharedCalender too

4 posts, 1 answers
  1. Rory
    Rory avatar
    159 posts
    Member since:
    Jul 2007

    Posted 06 Oct 2009 Link to this post

    Hi i'm using this code.

    function disable()  
       var picker = $find("<%= RadDatePicker1.ClientID %>");  
    function enable()  
       var picker = $find("<%= RadDatePicker1.ClientID %>");         

    It disables the RadDatePicker but it also breaks the SharedCalendar that the DatePicker is using. Which means all other DatePickers on the page stop working correctly. Please Advise.
  2. Sebastian
    Sebastian avatar
    9934 posts

    Posted 09 Oct 2009 Link to this post

    Hello Rory,

    indeed this is expected because by default when you disable an entire date picker, you disable the input, popup button and its popup calendar. Hence when you share single calendar among several date picker controls and disable one of them in this way, the calendar will be disable for all.

    To avoid that you need to disable the date input and popup button only as demonstrated in the forthcoming example:

              <script type="text/javascript">  

                function DisableFirstPicker()  


                  var firstPicker = $find("<%=RadDatePicker1.ClientID %>");  

                  firstPicker.get_textBox().disabled = "disabled";  

                  firstPicker.get_popupButton().disabled = "disabled";  



                <asp:ScriptManager ID="ScriptManager1" runat="server" /> 

                <telerik:RadDatePicker ID="RadDatePicker1" runat="server" SharedCalendarID="RadCalendar1" /> 

                <telerik:RadDatePicker ID="RadDatePicker2" runat="server" SharedCalendarID="RadCalendar1" /> 

                <telerik:RadDatePicker ID="RadDatePicker3" runat="server" SharedCalendarID="RadCalendar1" /> 

                <br /> 

                <input type="button" value="Disable first picker" onclick="DisableFirstPicker()" /> 

                <telerik:RadCalendar ID="RadCalendar1" runat="server" /> 

    Best regards,
    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. DevCraft R3 2016 release webinar banner
  4. Tom Jaspering
    Tom Jaspering avatar
    34 posts
    Member since:
    May 2006

    Posted 10 Apr 2012 Link to this post

    After upgrading to the latest 2012 build. This functionality of disabling the textbox is leading to javascript errors while clicking the disabled textbox of the datepicker.

    This is the error:
    "Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."

    Please Advise.
  5. Answer
    Tom Jaspering
    Tom Jaspering avatar
    34 posts
    Member since:
    May 2006

    Posted 11 Apr 2012 Link to this post

    This works and prevents the javascript error in IE8

    var rdp = $find("<%=RadDatePicker1.ClientID %>");  
        rdp.get_textBox().readOnly = true;
        rdp.get_textBox().disabled = "disabled"; 
        rdp.get_popupButton().disabled = "disabled";
        rdp.get_textBox().readOnly = false;
        rdp.get_textBox().disabled = "";  
        rdp.get_popupButton().disabled = "";
Back to Top