Eye Candy

3 posts, 0 answers
  1. Philip Senechal
    Philip Senechal avatar
    152 posts
    Member since:
    Apr 2008

    Posted 06 Aug 2010 Link to this post

    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. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 11 Aug 2010 Link to this post

    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
  3. Philip Senechal
    Philip Senechal avatar
    152 posts
    Member since:
    Apr 2008

    Posted 11 Aug 2010 Link to this post

    Ahhh...it was the sender.get_inputDomElement() part that I wasn't getting correct.

    Thank you so much...that works perfectly!
Back to Top