M
Mike Owen
I have a DropDownList box that I assign values from as follows:
drpColor.DataSource = myVariancecolor
drpColor.DataBind()
Where myVariancecolor is an ArrayList. This works fine and a list of my
colours is shown in the drop down.
I would now like to take this one stage further and actually change the
background colour of each option to be that of the colour.
Once the control is rendered as HTML in the browser, this can be done for
the colour RED for example by manually changing the code for a particular
colour option from:
<option value="11071">Red</option>
To:
<option value="11071" style="COLOR: black; BACKGROUND-COLOR:
Red">Red</option>
Has anyone got any idea how or if this 'BACKGROUND-COLOR' style value can be
changed programmatically for all colours in the list?
If not is there a better way of doing it without having to write the code to
build the HTML for the drop down from scratch?
Thanks, Mike.
drpColor.DataSource = myVariancecolor
drpColor.DataBind()
Where myVariancecolor is an ArrayList. This works fine and a list of my
colours is shown in the drop down.
I would now like to take this one stage further and actually change the
background colour of each option to be that of the colour.
Once the control is rendered as HTML in the browser, this can be done for
the colour RED for example by manually changing the code for a particular
colour option from:
<option value="11071">Red</option>
To:
<option value="11071" style="COLOR: black; BACKGROUND-COLOR:
Red">Red</option>
Has anyone got any idea how or if this 'BACKGROUND-COLOR' style value can be
changed programmatically for all colours in the list?
If not is there a better way of doing it without having to write the code to
build the HTML for the drop down from scratch?
Thanks, Mike.