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

Eye Candy

2 Answers 37 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Philip Senechal
Top achievements
Rank 1
Philip Senechal asked on 06 Aug 2010, 09:41 PM
Trying to add a bit of visual eye candy to my RadComboBox...

I am pre-populating a RadComboBox with values from a database. While doing this, I'm adding an item at the top called "Select an Analyst" which gets used if the value is null. I'm adding this item in italics...kind of how it looks when use EmptyMessage. What I would like to do though, is if someone selects an item in the RadComboBox that is not "Select an Analyst", the font changes back to normal.

I'm assuming I would have to do this with client side javascript, but I can't seem to figure out client side how to change the font property of the RadComboBox. I'm using the OnClientSelectedIndexChanged event. Can I change the font style based on the eventArgs client side?

Thanks for the help!

2 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 11 Aug 2010, 09:53 AM
Hello Philip Senechal,

You can change the style properties of the text at RadComboBox input handling the  OnClientSelectedIndexChanged event like this:

function OnClientSelectedIndexChangedHandler(sender, eventArgs) {
    var input = sender.get_inputDomElement();
 
    if (sender.get_selectedItem().get_text() == "Select an Analyst") {
        input.style.fontStyle = "italic";
    }
    else {
        input.style.fontStyle = "normal";
    }
}


Greetings,
Kalina
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
0
Philip Senechal
Top achievements
Rank 1
answered on 11 Aug 2010, 09:17 PM
Ahhh...it was the sender.get_inputDomElement() part that I wasn't getting correct.

Thank you so much...that works perfectly!
Tags
ComboBox
Asked by
Philip Senechal
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Philip Senechal
Top achievements
Rank 1
Share this question
or