Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I'm trying to write a simple color-picker that will run in a browser. So far I've got a dropDownList populated with the names of known colors. I'd like to have each ListItem also have a small box filled with the appropriate color. I know how to do this in a Windows Forms environment, but I'm at a loss as to how to accomplish the same thing in ASP.NET. Has anyone out there ever done anything similar to this?

"It may be roundly asserted that human ingenuity cannot concoct a cipher which human ingenuity cannot resolve."

 

- Edgar Allan Poe, 1841

 

I long to accomplish great and noble tasks, but it is my chief duty to accomplish humble tasks as though they were great and noble. The world is moved along, not only by the mighty shoves of its heroes, but also by the aggregate of the tiny pushes of each honest worker.

 

- Helen Keller

  • *Gurus*
Posted

While you can't add child elements to option elements, you can set their style properties.

 

<select>
<option value="FF0000" style="background-color: #FF0000;">Red</option>
<option value="FFFF00" style="background-color: #FFFF00;">Yellow</option>
<option value="FF00FF" style="background-color: #FF00FF;">Purple</option>
<option value="00FF00" style="background-color: #00FF00;">Green</option>
<option value="0000FF" style="background-color: #0000FF;">Blue</option>
</select>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...