Change background color of item

2 posts, 1 answers
  1. Aneesh
    Aneesh avatar
    9 posts
    Member since:
    May 2012

    Posted 20 Jun 2012 Link to this post

    How can I change the background color of selected item of a rad combobox according to the value. If the selected value is red, then the background color should be red.

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

    Posted 20 Jun 2012 Link to this post

    Hi Aneesh,

    Try the following javascript to achieve your scenario.

    JS:
    <script type="text/javascript" >
            function OnClientSelectedIndexChanged(sender, args)
            {
                args.get_item()._element.style.backgroundColor = args.get_item().get_value() ;
            }
    </script>

    Thanks,
    Princy.
Back to Top