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

[Solved] color individual RadComboBoxItem?

3 Answers 289 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jake
Top achievements
Rank 1
Jake asked on 21 Apr 2008, 11:48 PM
Is it possible to change the color of individual items in a RadComboBox on the client side?  Something like the following is what I mean (obviously this doesn't work or I wouldn't have a problem).

myCombo.get_items().getItem(0).get_attributes().setAttribute("style", "font-color:red;");

Thank you.

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 24 Apr 2008, 05:05 PM
Hello Jake,

I suggest that you try the following:

myCombo.get_items().getItem(0).get_element().style.color = "red"

I hope this helps.

Kind regards,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Next Gear Solutions User
Top achievements
Rank 1
answered on 06 Mar 2010, 01:09 PM
Hi-

Can we apply different color to alternate lines in RadComboBox?

Thanx
Rajesh
0
Veronica
Telerik team
answered on 11 Mar 2010, 12:07 PM
Hi Rajesh Wadhwa,

Here's the solution. Just use the OnClientLoad event and add the same logic that Veskoni offered but iterate through the items of the combo with step of 2:

function onLoadHandler(sender, e) {
            var myCombo = $find("<%= RadComboBox1.ClientID %>");
            var items = myCombo.get_items();
            for (var i = 0; i < items.get_count(); i+=2) {
                items.getItem(i).get_element().style.color = "red";
                items.getItem(i+1).get_element().style.color = "yellow";
            
        }

You can find the full code attached as a .zip file.

Regards,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ComboBox
Asked by
Jake
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Next Gear Solutions User
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or