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

Listbox Items color changes based on value

1 Answer 325 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Bryan
Top achievements
Rank 1
Bryan asked on 01 Jun 2011, 10:46 PM
Hi guys, is it possible to change the colors of items within  the listbox?

i gave the listbox a text and datavalue, now the data value is a category value..if the first chosen type value is A..it would highlight other items that have the same value as the initial checked item

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Jun 2011, 06:28 AM
Hello Bryan,

You can achieve this by setting the BackColor property to the Item from the ItemDataBound.
C#:
protected void RadListBox4_ItemDataBound(object sender, RadListBoxItemEventArgs e)
   {
       if (e.Item.Text == "Your Text")
       {
           e.Item.BackColor = System.Drawing.Color.Red;
       }
   }

Thanks,
Shinu.
Tags
ListBox
Asked by
Bryan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or