Disable ComboBox with JavaScript / Style Lost?

4 posts, 0 answers
  1. Diana
    Diana avatar
    18 posts
    Member since:
    Nov 2012

    Posted 16 Mar 2013 Link to this post

    Hello,

    I use a RadComboBox in my web application. I need to disable it at a certain point using JavaScript. I referred to the Client-API on your site where you said this can be accomplished with "combo.disable()" statement.

    I used this statement. However, I noticed that the combobox border has kind of disappeared; it's like it turned to a label with the selected field as text. I'd like to be able to get the combobox disabled using JavaScript but without loosing the "rcbDisabled" style from the component. I tried to disable it in the codebehind and in the markup and it showed the desired behavior. But I need to achieve the same result in JavaScript. Recommendations?

    Screenshots attached to showcase: 
    * Enabled: to show the enabled version [Skin = Windows7].
    * JavaScriptDisabled: showing the weird result I got with JavaScript's "combo.disable()"
    * Markup_CodebehindDisabled: showing the desired behavior I'd like to get but using JavaScript.

    Thanks!
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Mar 2013 Link to this post

    Hello Diana,

    Please try the following JavaScript to achieve your scenario.

    JavaScript:
    <script type="text/javascript">
        function disableComboBox() {
            var rcb = $find('<%=RadComboBox1.ClientID %>');
            rcb._element.disabled = true;
            rcb._enabled = false;
        }
    </script>

    Thanks,
    Princy.

  3. Diana
    Diana avatar
    18 posts
    Member since:
    Nov 2012

    Posted 18 Mar 2013 Link to this post

    Hello Princy,

    Thank you so much for replying!

    I tried your approch; the input is "kind of" disabled; but the border is still blue not grey. Do you have an idea how I can set it to grey as in the ordinary disabling scenario?
  4. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 20 Mar 2013 Link to this post

    Hi Diana,

    This is a development issue. I had forwarded it to our developer team for further investigation. In addition, I had updated you Telerik Points.

    All the best,
    Hristo Valyavicharski
    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.
Back to Top