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

Show selected item with backcolor

1 Answer 20 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 29 Jun 2012, 02:00 AM
I have some items with their backcolor set.How to show the selected item with also the same color on selecting from client side?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Jun 2012, 03:15 AM
Hi Tina,

Try the following code snippet to achieve your scenario.

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

Hope this helps.

Thanks,
Princy.
Tags
ComboBox
Asked by
Tina
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or