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

Change color for each radlistbox item

2 Answers 368 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 11 Apr 2012, 05:13 PM
Hello, please I need help. I need to change a diferent color for each item that I already databinded in a radlistbox. It doesnt matter if it's from the server or the client side. In addition Can I make separations like a radgrid in a Radlistbox?Thank You

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Apr 2012, 06:06 AM
Hi Victor,

You can set different color for each RadListBoxItem in client side by setting different styles using its index as follows.

JS:
<script type="text/javascript">
    function OnClientLoad(sender, args)
     {
            sender.get_items().getItem(0).get_element().style.backgroundColor = "Red";
            sender.get_items().getItem(1).get_element().style.backgroundColor = "Blue";
            sender.get_items().getItem(2).get_element().style.backgroundColor = "Green";
     }
</script>


Try the following code to provide border for each RadListBoxItem.

CSS:
<style type="text/css">
   .RadListBox .rlbItem
    {
        border:1px solid Black !important;
    }
</style>

Hope this helps,

Regards,
Princy.
0
Victor
Top achievements
Rank 1
answered on 16 May 2012, 05:00 PM
Thank you very much . It works.
Tags
ListBox
Asked by
Victor
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Victor
Top achievements
Rank 1
Share this question
or