Enable / Disable issue in client side

2 posts, 0 answers
  1. Velkumar
    Velkumar avatar
    16 posts
    Member since:
    Jul 2012

    Posted 20 May 2014 Link to this post

    Hi, 

    I have a RadDatePicker control below is my code, i need to make enable and disable based on checkbox checked. i am facing issue while enable & disable calendar popup button is still disabled, so i can't able to select the date. 

    <telerik:RadDatePicker ID="endDateDatePicker" runat="server" Width="140px"
    DateInput-EmptyMessage="" MinDate="01/01/1000" MaxDate="01/01/3000" Enabled="false">
    <Calendar id="endDateCalendar" runat="server">
     <SpecialDays>
    <telerik:RadCalendarDay Repeatable="Today" ItemStyle-CssClass="rcToday">
    </telerik:RadCalendarDay>
    </SpecialDays>
    </Calendar>
    </telerik:RadDatePicker>

    function checkedChanged(ctrl)
    {
    var comboBox = $get(ctrl.id);
    var datePicker = $find('<%= endDateDatePicker.ClientID %>');            
    if (comboBox != null && datePicker != null)
    {
    if (comboBox.checked) {
    datePicker.get_dateInput().enable();                      
    }
    else {
    datePicker.get_dateInput().disable();                     
    }
    }
    }

    <asp:CheckBox ID="cancelledCheckBox" runat="server" ClientIDMode="Static"
    Skin="Metro" onclick="checkedChanged(this)"></asp:CheckBox>
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 May 2014 in reply to Velkumar Link to this post

    Hi Velkumar,

    Please do the following modifications in your JavaScript which works fine at my end.

    JavaScript:
    function checkedChanged(ctrl) {
        var comboBox = $get(ctrl.id);
        var datePicker = $find('<%= endDateDatePicker.ClientID %>');
        if (comboBox != null && datePicker != null) {
            if (comboBox.checked) {
                datePicker.set_enabled(true);
            }
            else {
                datePicker.set_enabled(false);
            }
        }
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top