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

RadComboBoxItem CSS Class

1 Answer 292 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
fabian
Top achievements
Rank 1
fabian asked on 02 Mar 2012, 07:24 PM
I'm trying to add a css class to each RadComboBoxItem in a RadComboBox dunmicaly.

This is not working:
foreach (var status in statuslist)
{
    RadComboBoxItem item = new RadComboBoxItem(status.StockName, status.StockStatusID.ToString());
    item.Attributes.Add("Class", status.StockColor);
    RadComboBox1.Items.Add(item);
}


also tried :
item.CssClass =  status.StockColor;

Neither one uses the css class

any suggestions?

thanks

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Mar 2012, 07:04 AM
Hello,

Take a look into the following code.
C#:
foreach (RadComboBoxItem item in radcombobox1.Items)
 {
  item.CssClass = "StockColor";
 }

CSS:
.StockColor
 {
  color:Red;
 }

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