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

Change background color of item

1 Answer 84 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Aneesh
Top achievements
Rank 1
Aneesh asked on 20 Jun 2012, 10:33 AM
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

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 20 Jun 2012, 11:18 AM
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.
Tags
ComboBox
Asked by
Aneesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or