This is a migrated thread and some comments may be shown as answers.

Disable ComboBox with JavaScript / Style Lost?

3 Answers 156 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Diana
Top achievements
Rank 1
Diana asked on 16 Mar 2013, 05:24 PM
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!

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Mar 2013, 05:45 AM
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.

0
Diana
Top achievements
Rank 1
answered on 18 Mar 2013, 06:05 AM
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?
0
Hristo Valyavicharski
Telerik team
answered on 20 Mar 2013, 04:31 PM
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.
Tags
ComboBox
Asked by
Diana
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Diana
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or