Setting background list item color in dropdown list control

Discussion in 'ASP .Net Web Controls' started by M. Craig, Nov 12, 2003.

  1. M. Craig

    M. Craig Guest

    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.Attributes.Add("style", "background-color:red" );
    //+ rdrColors["color"].ToString()

    }
    }
     
    M. Craig, Nov 12, 2003
    #1
    1. Advertising

  2. Hi,

    You have hit a well-known bug[1]

    [1]
    http://groups.google.com/groups?hl=...st&ie=UTF-8&oe=UTF-8&hl=en&btnG=Google+Search

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

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

    "M. Craig" <> wrote in message
    news:...
    > 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.Attributes.Add("style", "background-color:red" );
    > //+ rdrColors["color"].ToString()
    >
    > }
    > }
    >
    >
     
    Victor Garcia Aprea [MVP], Jan 9, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmVraGE=?=
    Replies:
    7
    Views:
    3,352
    Eswar
    Mar 26, 2007
  2. M. Craig

    How to set background color of List item in dropdown list

    M. Craig, Nov 12, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    323
    M. Craig
    Nov 12, 2003
  3. fig000
    Replies:
    0
    Views:
    4,587
    fig000
    Sep 6, 2004
  4. Kamaljeet Saini
    Replies:
    0
    Views:
    478
    Kamaljeet Saini
    Feb 13, 2009
  5. Replies:
    1
    Views:
    308
    marss
    Feb 14, 2007
Loading...

Share This Page