Change Item Color Based On Checked.

2 posts, 1 answers
  1. Teena
    Teena avatar
    16 posts
    Member since:
    Feb 2013

    Posted 05 Mar 2013 Link to this post


    There is a ListBox control in my user page and I want to change the color of the ListBox item based on the checked state of the item. Suppose if the item is checked the font color should change to blue and on unchecking the font color must change to the original color. I want this to be done from client code.

    Thank you,
  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Mar 2013 Link to this post

    Hello Teena,

    Try the following JavaScript in the OnClientItemChecked event of the RadListBox.

    <script type="text/javascript">
        function OnClientItemChecked(sender, args) {
            if (args.get_item().get_checked() == true) {
                args.get_item() = "red"
            else {
                args.get_item() = "black"

Back to Top