Setting background list item color in dropdown list control

Setting background list item color in dropdown list control

Post by M. Crai » Fri, 14 Nov 2003 03:56:59


I've been trying the following code to programtically set the background
color for each list item, and have been unsuccessfull. Does anyone have any
ideas on a better way?

Thanks,

Mike


public void setStatusCodeColors()
{
// Get Status Code and Colors
ASPNetPortal.Components.CMPortal_Funcs oCM = new
Components.CMPortal_Funcs();
SqlDataReader rdrColors = oCM.getStatusCodes();
// Get first item in reader
rdrColors.Read();
for (int i =0;i < drpStatusCode.Items.Count ;i++ )
{
drpStatusCode.Items[i].Attributes.Add("style", "background-color:red" );
//+ rdrColors["color"].ToString()

}
}
 
 
 

Setting background list item color in dropdown list control

Post by Victor Gar » Sat, 10 Jan 2004 12:32:18

Hi,

You have hit a well-known bug[1]

[1]
http://www.yqcomputer.com/ %23liY77uzBHA.2380%40tkmsftngp04&rnum=1&prev=/groups%3Fq%3Dbug%2Bin%2Bdropdownlist%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den%26btnG%3DGoogle%2BSearch

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://www.yqcomputer.com/

To contact me remove 'NOSPAM'. Please post all questions to the newsgroup



any