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

how to color each option with set database colors

1 Answer 53 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 18 May 2017, 02:35 PM
I call a database to populate my RadCombobox with ID, CategoryName, BackgroundColor, TextColor
how can I change each option in the drop down to use these options.
my current combobox is a listing of checkboxes.

I already have written out css classes for each one and possibly all I need to do is set each option's css class.
How to do?

1 Answer, 1 is accepted

Sort by
0
Doug
Top achievements
Rank 1
answered on 18 May 2017, 06:03 PM

ok after searching I found you can set the class on the code behind using property like this

ddlCatToShow.Items.Add(New Telerik.Web.UI.RadComboBoxItem(dr("CategoryName"), dr("Category")))
ddlCatToShow.Items(ddlCatToShow.Items.Count - 1).CssClass = "mapping" & dr("Category")
css = css & ".mapping" & dr("Category") & "{" & vbCrLf & _
                    "color:" & dr("TextColor") & ";" & vbCrLf & _
                    "background-color:" & dr("Color") & ";" & vbCrLf & _
                    "}" & vbCrLf
Tags
ComboBox
Asked by
Doug
Top achievements
Rank 1
Answers by
Doug
Top achievements
Rank 1
Share this question
or