Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 20th, 2006, 03:51 AM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dropdown list Backround color?

Hi
I'm building web application using asp.net 2.0 and c#2005, i have dropdown list, with the following items
Red
Blue
Green
Brown
Yellow

I want to set the background of the item to the color that correspond wih the name, or set the item font color correspond with the name.

I don't how to do that.

Thanx

 
Old April 20th, 2006, 07:12 AM
Authorized User
 
Join Date: Apr 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

don't know if this is what you want and only works with 2.0:

foreach (ListItem item in this.dropDownList1.Items)
{
if(....//whatever you want....)
   item.Attributes.Add("style", "background-color: Red");
}


 
Old April 20th, 2006, 07:23 AM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Works like magic

Thanx






Similar Threads
Thread Thread Starter Forum Replies Last Post
Change the backround color to cell ricespn Beginning VB 6 0 November 4th, 2006 12:39 PM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
Hover color of dropdown items toshi ASP.NET 1.0 and 1.1 Basics 0 May 3rd, 2006 04:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.