Disable DropDownList

2 posts, 0 answers
  1. Den
    Den avatar
    17 posts
    Member since:
    Apr 2012

    Posted 05 Jun 2012 Link to this post


    I use RadFormDecorator for styling. My form contains a DropDownList (asp:DropDownList). I want to disable/enable the DropDownList by javascript.
    if (chb.checked) {
       jQuery("#" + ddlId).removeAttr('disabled');
    } else {
       jQuery("#" + ddlId).attr('disabled', 'disabled');

    It works good in FF and Chrome. But it does not work in IE.
    How can I fix it?

  2. Niko
    Niko avatar
    383 posts

    Posted 06 Jun 2012 Link to this post

    Hi Den,

    In IE there is an issue with the disabled property of the DOM elements, when it comes to tracking it. This issue is reproduced only when the element is enabled and should become disabled. The other way around the tracking is working, i.e. if the select is disabled it can be enabled and IE will raise an event about it. This is a browser issue and there is nothing that we can do on our side to work around it.

    Nevertheless there is a different approach that should work. For decorated select elements there is a FormDecorator method to update the decoration on it when the disabled property changes. Here is a sample piece of code:
        $addHandler($get("checkbox"), "click", function()
            var fd = getFormDecorator();
            var select = $get("select");
            select.disabled = !$get("checkbox").checked;
    function getFormDecorator()
        return $find("theFormDecorator");

    Hope this helps.

    All the best,
    the Telerik team
    Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
  3. DevCraft R3 2016 release webinar banner
Back to Top