how to color each option with set database colors

2 posts, 0 answers
  1. Doug
    Doug avatar
    104 posts
    Member since:
    Aug 2014

    Posted 18 May 2017 Link to this post

    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?
  2. Doug
    Doug avatar
    104 posts
    Member since:
    Aug 2014

    Posted 18 May 2017 Link to this post

    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
Back to Top