Show selected item with backcolor

2 posts, 0 answers
  1. Tina
    Tina avatar
    130 posts
    Member since:
    Jul 2011

    Posted 28 Jun 2012 Link to this post

    I have some items with their backcolor set.How to show the selected item with also the same color on selecting from client side?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 Jun 2012 Link to this post

    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.
Back to Top