DropDownList BackgroundColor not set

Discussion in 'ASP .Net' started by Cliff Cotterill, Nov 15, 2007.

  1. I've tried multiple ways of setting the background-color of a DropDownList,
    but none seem to work.
    How can the color be set?

    I've tried setting the BackGroundColor of the DrowDownList component, and
    also setting it for each of the List Items.
    The resulting .html code looks correct. Why doesn't the color display?

    Code
    DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    DropDownListWorkLocation.ControlStyle.BackColor =
    System.Drawing.Color.PowderBlue;
    DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat",
    "repeat-y");
    DropDownListWorkLocation.Attributes.CssStyle.Add("background-color",
    "powderblue");
    DropDownListWorkLocation.Items[0].Attributes.Add("style",
    "color:powderblue");
    for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    {
    DropDownListWorkLocation.Items.Attributes.Add("style",
    "background-color:powderblue; ");
    }

    Resulting HTML

    <td style="height: 20px;" nowrap="noWrap" width="19%">
    <select name="DropDownListWorkLocation" id="DropDownListWorkLocation"
    tabindex="9"
    style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    <option selected="selected" value="" style="background-color:powderblue;
    "></option>
    <option value="123 Main Street" style="background-color:powderblue; ">123
    Main Street</option>
    <option value="456 Boulevard" style="background-color:powderblue; ">456
    Boulevard</option>
    <option value="789 Avenue" style="background-color:powderblue; ">789
    Avenue</option>
    </select>
    </td>
     
    Cliff Cotterill, Nov 15, 2007
    #1
    1. Advertising

  2. Hi, Cliff.

    Use :

    DropDownListWorkLocation.Attributes.Add("style", "background:powderblue");

    If you want to apply different colors to different rows, adapt this :

    If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    DropDownListWorkLocation.Attributes.Add("style", "background:red")
    Else
    DropDownListWorkLocation.Attributes.Add("style", "background:yellow")
    End If

    ....or some such variation.





    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Cliff Cotterill" <> wrote in message news:%...
    > I've tried multiple ways of setting the background-color of a DropDownList, but none seem to work.
    > How can the color be set?
    >
    > I've tried setting the BackGroundColor of the DrowDownList component, and also setting it for each of the List Items.
    > The resulting .html code looks correct. Why doesn't the color display?
    >
    > Code
    > DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    > DropDownListWorkLocation.ControlStyle.BackColor = System.Drawing.Color.PowderBlue;
    > DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat", "repeat-y");
    > DropDownListWorkLocation.Attributes.CssStyle.Add("background-color", "powderblue");
    > DropDownListWorkLocation.Items[0].Attributes.Add("style", "color:powderblue");
    > for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    > {
    > DropDownListWorkLocation.Items.Attributes.Add("style", "background-color:powderblue; ");
    > }
    >
    > Resulting HTML
    >
    > <td style="height: 20px;" nowrap="noWrap" width="19%">
    > <select name="DropDownListWorkLocation" id="DropDownListWorkLocation" tabindex="9"
    > style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    > <option selected="selected" value="" style="background-color:powderblue; "></option>
    > <option value="123 Main Street" style="background-color:powderblue; ">123 Main Street</option>
    > <option value="456 Boulevard" style="background-color:powderblue; ">456 Boulevard</option>
    > <option value="789 Avenue" style="background-color:powderblue; ">789 Avenue</option>
    > </select>
    > </td>
    >
    >
     
    Juan T. Llibre, Nov 15, 2007
    #2
    1. Advertising

  3. I should have added that you can set both the background
    and foreground colors in the same style properties, but you know that, right ?

    Attributes.Add("style", "background: red; color: white;")

    ....would give you white letters on a red background.



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Juan T. Llibre" <> wrote in message news:...
    > Hi, Cliff.
    >
    > Use :
    >
    > DropDownListWorkLocation.Attributes.Add("style", "background:powderblue");
    >
    > If you want to apply different colors to different rows, adapt this :
    >
    > If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    > DropDownListWorkLocation.Attributes.Add("style", "background:red")
    > Else
    > DropDownListWorkLocation.Attributes.Add("style", "background:yellow")
    > End If
    >
    > ...or some such variation.
    >
    >
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "Cliff Cotterill" <> wrote in message news:%...
    >> I've tried multiple ways of setting the background-color of a DropDownList, but none seem to work.
    >> How can the color be set?
    >>
    >> I've tried setting the BackGroundColor of the DrowDownList component, and also setting it for each of the List Items.
    >> The resulting .html code looks correct. Why doesn't the color display?
    >>
    >> Code
    >> DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    >> DropDownListWorkLocation.ControlStyle.BackColor = System.Drawing.Color.PowderBlue;
    >> DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat", "repeat-y");
    >> DropDownListWorkLocation.Attributes.CssStyle.Add("background-color", "powderblue");
    >> DropDownListWorkLocation.Items[0].Attributes.Add("style", "color:powderblue");
    >> for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    >> {
    >> DropDownListWorkLocation.Items.Attributes.Add("style", "background-color:powderblue; ");
    >> }
    >>
    >> Resulting HTML
    >>
    >> <td style="height: 20px;" nowrap="noWrap" width="19%">
    >> <select name="DropDownListWorkLocation" id="DropDownListWorkLocation" tabindex="9"
    >> style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    >> <option selected="selected" value="" style="background-color:powderblue; "></option>
    >> <option value="123 Main Street" style="background-color:powderblue; ">123 Main Street</option>
    >> <option value="456 Boulevard" style="background-color:powderblue; ">456 Boulevard</option>
    >> <option value="789 Avenue" style="background-color:powderblue; ">789 Avenue</option>
    >> </select>
    >> </td>
    >>
    >>

    >
    >
     
    Juan T. Llibre, Nov 15, 2007
    #3
  4. I tried it and the background-color still shows as a dark gray.
    Here's the HTML it produced:
    <select name="DropDownListWorkLocation" id="DropDownListWorkLocation"
    tabindex="9" style="font-weight:bold;width:90%;background:powderblue">



    "Juan T. Llibre" <> wrote in message
    news:...
    > Hi, Cliff.
    >
    > Use :
    >
    > DropDownListWorkLocation.Attributes.Add("style", "background:powderblue");
    >
    > If you want to apply different colors to different rows, adapt this :
    >
    > If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    > DropDownListWorkLocation.Attributes.Add("style", "background:red")
    > Else
    > DropDownListWorkLocation.Attributes.Add("style", "background:yellow")
    > End If
    >
    > ...or some such variation.
    >
    >
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "Cliff Cotterill" <> wrote in message
    > news:%...
    >> I've tried multiple ways of setting the background-color of a
    >> DropDownList, but none seem to work.
    >> How can the color be set?
    >>
    >> I've tried setting the BackGroundColor of the DrowDownList component, and
    >> also setting it for each of the List Items.
    >> The resulting .html code looks correct. Why doesn't the color display?
    >>
    >> Code
    >> DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    >> DropDownListWorkLocation.ControlStyle.BackColor =
    >> System.Drawing.Color.PowderBlue;
    >> DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat",
    >> "repeat-y");
    >> DropDownListWorkLocation.Attributes.CssStyle.Add("background-color",
    >> "powderblue");
    >> DropDownListWorkLocation.Items[0].Attributes.Add("style",
    >> "color:powderblue");
    >> for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    >> {
    >> DropDownListWorkLocation.Items.Attributes.Add("style",
    >> "background-color:powderblue; ");
    >> }
    >>
    >> Resulting HTML
    >>
    >> <td style="height: 20px;" nowrap="noWrap" width="19%">
    >> <select name="DropDownListWorkLocation" id="DropDownListWorkLocation"
    >> tabindex="9"
    >> style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    >> <option selected="selected" value="" style="background-color:powderblue;
    >> "></option>
    >> <option value="123 Main Street" style="background-color:powderblue; ">123
    >> Main Street</option>
    >> <option value="456 Boulevard" style="background-color:powderblue; ">456
    >> Boulevard</option>
    >> <option value="789 Avenue" style="background-color:powderblue; ">789
    >> Avenue</option>
    >> </select>
    >> </td>
    >>
    >>

    >
    >
     
    Cliff Cotterill, Nov 15, 2007
    #4
  5. That works with red and white, maybe there is a problem with
    System.Drawing.Color.PowderBlue not being recognized ?


    "Juan T. Llibre" <> wrote in message
    news:e%...
    >I should have added that you can set both the background
    > and foreground colors in the same style properties, but you know that,
    > right ?
    >
    > Attributes.Add("style", "background: red; color: white;")
    >
    > ...would give you white letters on a red background.
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "Juan T. Llibre" <> wrote in message
    > news:...
    >> Hi, Cliff.
    >>
    >> Use :
    >>
    >> DropDownListWorkLocation.Attributes.Add("style",
    >> "background:powderblue");
    >>
    >> If you want to apply different colors to different rows, adapt this :
    >>
    >> If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    >> DropDownListWorkLocation.Attributes.Add("style", "background:red")
    >> Else
    >> DropDownListWorkLocation.Attributes.Add("style", "background:yellow")
    >> End If
    >>
    >> ...or some such variation.
    >>
    >>
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ======================================
    >> "Cliff Cotterill" <> wrote in message
    >> news:%...
    >>> I've tried multiple ways of setting the background-color of a
    >>> DropDownList, but none seem to work.
    >>> How can the color be set?
    >>>
    >>> I've tried setting the BackGroundColor of the DrowDownList component,
    >>> and also setting it for each of the List Items.
    >>> The resulting .html code looks correct. Why doesn't the color display?
    >>>
    >>> Code
    >>> DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    >>> DropDownListWorkLocation.ControlStyle.BackColor =
    >>> System.Drawing.Color.PowderBlue;
    >>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat",
    >>> "repeat-y");
    >>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-color",
    >>> "powderblue");
    >>> DropDownListWorkLocation.Items[0].Attributes.Add("style",
    >>> "color:powderblue");
    >>> for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    >>> {
    >>> DropDownListWorkLocation.Items.Attributes.Add("style",
    >>> "background-color:powderblue; ");
    >>> }
    >>>
    >>> Resulting HTML
    >>>
    >>> <td style="height: 20px;" nowrap="noWrap" width="19%">
    >>> <select name="DropDownListWorkLocation" id="DropDownListWorkLocation"
    >>> tabindex="9"
    >>> style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    >>> <option selected="selected" value="" style="background-color:powderblue;
    >>> "></option>
    >>> <option value="123 Main Street" style="background-color:powderblue;
    >>> ">123 Main Street</option>
    >>> <option value="456 Boulevard" style="background-color:powderblue; ">456
    >>> Boulevard</option>
    >>> <option value="789 Avenue" style="background-color:powderblue; ">789
    >>> Avenue</option>
    >>> </select>
    >>> </td>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Cliff Cotterill, Nov 15, 2007
    #5
  6. re:
    !> That works with red and white, maybe there is a problem with
    !> System.Drawing.Color.PowderBlue not being recognized ?

    According to :

    http://msdn2.microsoft.com/en-us/library/system.drawing.color_properties(VS.80).aspx

    ....it should be recognized.

    PowderBlue is a system-defined color.

    Instead of passing the whole qualified name, try passing just the color name itself:

    i.e., instead of :
    System.Drawing.Color.PowderBlue;

    use :
    PowderBlue;



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Cliff Cotterill" <> wrote in message news:...
    > That works with red and white, maybe there is a problem with System.Drawing.Color.PowderBlue not being recognized ?
    >
    >
    > "Juan T. Llibre" <> wrote in message news:e%...
    >>I should have added that you can set both the background
    >> and foreground colors in the same style properties, but you know that, right ?
    >>
    >> Attributes.Add("style", "background: red; color: white;")
    >>
    >> ...would give you white letters on a red background.
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ======================================
    >> "Juan T. Llibre" <> wrote in message news:...
    >>> Hi, Cliff.
    >>>
    >>> Use :
    >>>
    >>> DropDownListWorkLocation.Attributes.Add("style", "background:powderblue");
    >>>
    >>> If you want to apply different colors to different rows, adapt this :
    >>>
    >>> If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    >>> DropDownListWorkLocation.Attributes.Add("style", "background:red")
    >>> Else
    >>> DropDownListWorkLocation.Attributes.Add("style", "background:yellow")
    >>> End If
    >>>
    >>> ...or some such variation.
    >>>
    >>>
    >>>
    >>>
    >>>
    >>> Juan T. Llibre, asp.net MVP
    >>> asp.net faq : http://asp.net.do/faq/
    >>> foros de asp.net, en español : http://asp.net.do/foros/
    >>> ======================================
    >>> "Cliff Cotterill" <> wrote in message news:%...
    >>>> I've tried multiple ways of setting the background-color of a DropDownList, but none seem to work.
    >>>> How can the color be set?
    >>>>
    >>>> I've tried setting the BackGroundColor of the DrowDownList component, and also setting it for each of the List
    >>>> Items.
    >>>> The resulting .html code looks correct. Why doesn't the color display?
    >>>>
    >>>> Code
    >>>> DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    >>>> DropDownListWorkLocation.ControlStyle.BackColor = System.Drawing.Color.PowderBlue;
    >>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat", "repeat-y");
    >>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-color", "powderblue");
    >>>> DropDownListWorkLocation.Items[0].Attributes.Add("style", "color:powderblue");
    >>>> for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    >>>> {
    >>>> DropDownListWorkLocation.Items.Attributes.Add("style", "background-color:powderblue; ");
    >>>> }
    >>>>
    >>>> Resulting HTML
    >>>>
    >>>> <td style="height: 20px;" nowrap="noWrap" width="19%">
    >>>> <select name="DropDownListWorkLocation" id="DropDownListWorkLocation" tabindex="9"
    >>>> style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    >>>> <option selected="selected" value="" style="background-color:powderblue; "></option>
    >>>> <option value="123 Main Street" style="background-color:powderblue; ">123 Main Street</option>
    >>>> <option value="456 Boulevard" style="background-color:powderblue; ">456 Boulevard</option>
    >>>> <option value="789 Avenue" style="background-color:powderblue; ">789 Avenue</option>
    >>>> </select>
    >>>> </td>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Juan T. Llibre, Nov 15, 2007
    #6
  7. See PowderBlue rendered in my example at :

    http://asp.net.do/test/dropdowncolor3.aspx

    That example uses :

    DDL1.Items(i).Attributes.Add("style", "background:powderBlue")




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Juan T. Llibre" <> wrote in message news:%...
    > re:
    > !> That works with red and white, maybe there is a problem with
    > !> System.Drawing.Color.PowderBlue not being recognized ?
    >
    > According to :
    >
    > http://msdn2.microsoft.com/en-us/library/system.drawing.color_properties(VS.80).aspx
    >
    > ...it should be recognized.
    >
    > PowderBlue is a system-defined color.
    >
    > Instead of passing the whole qualified name, try passing just the color name itself:
    >
    > i.e., instead of :
    > System.Drawing.Color.PowderBlue;
    >
    > use :
    > PowderBlue;
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "Cliff Cotterill" <> wrote in message news:...
    >> That works with red and white, maybe there is a problem with System.Drawing.Color.PowderBlue not being recognized ?
    >>
    >>
    >> "Juan T. Llibre" <> wrote in message news:e%...
    >>>I should have added that you can set both the background
    >>> and foreground colors in the same style properties, but you know that, right ?
    >>>
    >>> Attributes.Add("style", "background: red; color: white;")
    >>>
    >>> ...would give you white letters on a red background.
    >>>
    >>>
    >>>
    >>> Juan T. Llibre, asp.net MVP
    >>> asp.net faq : http://asp.net.do/faq/
    >>> foros de asp.net, en español : http://asp.net.do/foros/
    >>> ======================================
    >>> "Juan T. Llibre" <> wrote in message news:...
    >>>> Hi, Cliff.
    >>>>
    >>>> Use :
    >>>>
    >>>> DropDownListWorkLocation.Attributes.Add("style", "background:powderblue");
    >>>>
    >>>> If you want to apply different colors to different rows, adapt this :
    >>>>
    >>>> If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    >>>> DropDownListWorkLocation.Attributes.Add("style", "background:red")
    >>>> Else
    >>>> DropDownListWorkLocation.Attributes.Add("style", "background:yellow")
    >>>> End If
    >>>>
    >>>> ...or some such variation.
    >>>>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>> Juan T. Llibre, asp.net MVP
    >>>> asp.net faq : http://asp.net.do/faq/
    >>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>> ======================================
    >>>> "Cliff Cotterill" <> wrote in message news:%...
    >>>>> I've tried multiple ways of setting the background-color of a DropDownList, but none seem to work.
    >>>>> How can the color be set?
    >>>>>
    >>>>> I've tried setting the BackGroundColor of the DrowDownList component, and also setting it for each of the List
    >>>>> Items.
    >>>>> The resulting .html code looks correct. Why doesn't the color display?
    >>>>>
    >>>>> Code
    >>>>> DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    >>>>> DropDownListWorkLocation.ControlStyle.BackColor = System.Drawing.Color.PowderBlue;
    >>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat", "repeat-y");
    >>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-color", "powderblue");
    >>>>> DropDownListWorkLocation.Items[0].Attributes.Add("style", "color:powderblue");
    >>>>> for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    >>>>> {
    >>>>> DropDownListWorkLocation.Items.Attributes.Add("style", "background-color:powderblue; ");
    >>>>> }
    >>>>>
    >>>>> Resulting HTML
    >>>>>
    >>>>> <td style="height: 20px;" nowrap="noWrap" width="19%">
    >>>>> <select name="DropDownListWorkLocation" id="DropDownListWorkLocation" tabindex="9"
    >>>>> style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    >>>>> <option selected="selected" value="" style="background-color:powderblue; "></option>
    >>>>> <option value="123 Main Street" style="background-color:powderblue; ">123 Main Street</option>
    >>>>> <option value="456 Boulevard" style="background-color:powderblue; ">456 Boulevard</option>
    >>>>> <option value="789 Avenue" style="background-color:powderblue; ">789 Avenue</option>
    >>>>> </select>
    >>>>> </td>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Juan T. Llibre, Nov 15, 2007
    #7
  8. I tried that and background:blue changes the color to blue, but
    background:powderBlue displays as dark gray:
    DropDownListWorkLocation.Items.Attributes.Add("style",
    "background:powderBlue; ");
    It looks like it recognizes basic colors like red, blue, white, black ....
    but not all of those defined in System.Drawing.Color


    "Juan T. Llibre" <> wrote in message
    news:...
    > See PowderBlue rendered in my example at :
    >
    > http://asp.net.do/test/dropdowncolor3.aspx
    >
    > That example uses :
    >
    > DDL1.Items(i).Attributes.Add("style", "background:powderBlue")
    >
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "Juan T. Llibre" <> wrote in message
    > news:%...
    >> re:
    >> !> That works with red and white, maybe there is a problem with
    >> !> System.Drawing.Color.PowderBlue not being recognized ?
    >>
    >> According to :
    >>
    >> http://msdn2.microsoft.com/en-us/library/system.drawing.color_properties(VS.80).aspx
    >>
    >> ...it should be recognized.
    >>
    >> PowderBlue is a system-defined color.
    >>
    >> Instead of passing the whole qualified name, try passing just the color
    >> name itself:
    >>
    >> i.e., instead of :
    >> System.Drawing.Color.PowderBlue;
    >>
    >> use :
    >> PowderBlue;
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ======================================
    >> "Cliff Cotterill" <> wrote in message
    >> news:...
    >>> That works with red and white, maybe there is a problem with
    >>> System.Drawing.Color.PowderBlue not being recognized ?
    >>>
    >>>
    >>> "Juan T. Llibre" <> wrote in message
    >>> news:e%...
    >>>>I should have added that you can set both the background
    >>>> and foreground colors in the same style properties, but you know that,
    >>>> right ?
    >>>>
    >>>> Attributes.Add("style", "background: red; color: white;")
    >>>>
    >>>> ...would give you white letters on a red background.
    >>>>
    >>>>
    >>>>
    >>>> Juan T. Llibre, asp.net MVP
    >>>> asp.net faq : http://asp.net.do/faq/
    >>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>> ======================================
    >>>> "Juan T. Llibre" <> wrote in message
    >>>> news:...
    >>>>> Hi, Cliff.
    >>>>>
    >>>>> Use :
    >>>>>
    >>>>> DropDownListWorkLocation.Attributes.Add("style",
    >>>>> "background:powderblue");
    >>>>>
    >>>>> If you want to apply different colors to different rows, adapt this :
    >>>>>
    >>>>> If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    >>>>> DropDownListWorkLocation.Attributes.Add("style", "background:red")
    >>>>> Else
    >>>>> DropDownListWorkLocation.Attributes.Add("style", "background:yellow")
    >>>>> End If
    >>>>>
    >>>>> ...or some such variation.
    >>>>>
    >>>>>
    >>>>>
    >>>>>
    >>>>>
    >>>>> Juan T. Llibre, asp.net MVP
    >>>>> asp.net faq : http://asp.net.do/faq/
    >>>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>>> ======================================
    >>>>> "Cliff Cotterill" <> wrote in message
    >>>>> news:%...
    >>>>>> I've tried multiple ways of setting the background-color of a
    >>>>>> DropDownList, but none seem to work.
    >>>>>> How can the color be set?
    >>>>>>
    >>>>>> I've tried setting the BackGroundColor of the DrowDownList component,
    >>>>>> and also setting it for each of the List Items.
    >>>>>> The resulting .html code looks correct. Why doesn't the color
    >>>>>> display?
    >>>>>>
    >>>>>> Code
    >>>>>> DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    >>>>>> DropDownListWorkLocation.ControlStyle.BackColor =
    >>>>>> System.Drawing.Color.PowderBlue;
    >>>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat",
    >>>>>> "repeat-y");
    >>>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-color",
    >>>>>> "powderblue");
    >>>>>> DropDownListWorkLocation.Items[0].Attributes.Add("style",
    >>>>>> "color:powderblue");
    >>>>>> for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    >>>>>> {
    >>>>>> DropDownListWorkLocation.Items.Attributes.Add("style",
    >>>>>> "background-color:powderblue; ");
    >>>>>> }
    >>>>>>
    >>>>>> Resulting HTML
    >>>>>>
    >>>>>> <td style="height: 20px;" nowrap="noWrap" width="19%">
    >>>>>> <select name="DropDownListWorkLocation" id="DropDownListWorkLocation"
    >>>>>> tabindex="9"
    >>>>>> style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    >>>>>> <option selected="selected" value=""
    >>>>>> style="background-color:powderblue; "></option>
    >>>>>> <option value="123 Main Street" style="background-color:powderblue;
    >>>>>> ">123 Main Street</option>
    >>>>>> <option value="456 Boulevard" style="background-color:powderblue;
    >>>>>> ">456 Boulevard</option>
    >>>>>> <option value="789 Avenue" style="background-color:powderblue; ">789
    >>>>>> Avenue</option>
    >>>>>> </select>
    >>>>>> </td>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Cliff Cotterill, Nov 15, 2007
    #8
  9. Cliff,

    See PowderBlue rendered in my example at :

    http://asp.net.do/test/dropdowncolor3.aspx

    How does that appear when you view it ?
    Can you see PowderBlue...or do you see dark gray ?




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Cliff Cotterill" <> wrote in message news:%...
    >I tried that and background:blue changes the color to blue, but background:powderBlue displays as dark gray:
    > DropDownListWorkLocation.Items.Attributes.Add("style", "background:powderBlue; ");
    > It looks like it recognizes basic colors like red, blue, white, black .... but not all of those defined in
    > System.Drawing.Color
    >
    >
    > "Juan T. Llibre" <> wrote in message news:...
    >> See PowderBlue rendered in my example at :
    >>
    >> http://asp.net.do/test/dropdowncolor3.aspx
    >>
    >> That example uses :
    >>
    >> DDL1.Items(i).Attributes.Add("style", "background:powderBlue")
    >>
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ======================================
    >> "Juan T. Llibre" <> wrote in message news:%...
    >>> re:
    >>> !> That works with red and white, maybe there is a problem with
    >>> !> System.Drawing.Color.PowderBlue not being recognized ?
    >>>
    >>> According to :
    >>>
    >>> http://msdn2.microsoft.com/en-us/library/system.drawing.color_properties(VS.80).aspx
    >>>
    >>> ...it should be recognized.
    >>>
    >>> PowderBlue is a system-defined color.
    >>>
    >>> Instead of passing the whole qualified name, try passing just the color name itself:
    >>>
    >>> i.e., instead of :
    >>> System.Drawing.Color.PowderBlue;
    >>>
    >>> use :
    >>> PowderBlue;
    >>>
    >>>
    >>>
    >>> Juan T. Llibre, asp.net MVP
    >>> asp.net faq : http://asp.net.do/faq/
    >>> foros de asp.net, en español : http://asp.net.do/foros/
    >>> ======================================
    >>> "Cliff Cotterill" <> wrote in message news:...
    >>>> That works with red and white, maybe there is a problem with System.Drawing.Color.PowderBlue not being recognized ?
    >>>>
    >>>>
    >>>> "Juan T. Llibre" <> wrote in message news:e%...
    >>>>>I should have added that you can set both the background
    >>>>> and foreground colors in the same style properties, but you know that, right ?
    >>>>>
    >>>>> Attributes.Add("style", "background: red; color: white;")
    >>>>>
    >>>>> ...would give you white letters on a red background.
    >>>>>
    >>>>>
    >>>>>
    >>>>> Juan T. Llibre, asp.net MVP
    >>>>> asp.net faq : http://asp.net.do/faq/
    >>>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>>> ======================================
    >>>>> "Juan T. Llibre" <> wrote in message news:...
    >>>>>> Hi, Cliff.
    >>>>>>
    >>>>>> Use :
    >>>>>>
    >>>>>> DropDownListWorkLocation.Attributes.Add("style", "background:powderblue");
    >>>>>>
    >>>>>> If you want to apply different colors to different rows, adapt this :
    >>>>>>
    >>>>>> If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    >>>>>> DropDownListWorkLocation.Attributes.Add("style", "background:red")
    >>>>>> Else
    >>>>>> DropDownListWorkLocation.Attributes.Add("style", "background:yellow")
    >>>>>> End If
    >>>>>>
    >>>>>> ...or some such variation.
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>> Juan T. Llibre, asp.net MVP
    >>>>>> asp.net faq : http://asp.net.do/faq/
    >>>>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>>>> ======================================
    >>>>>> "Cliff Cotterill" <> wrote in message news:%...
    >>>>>>> I've tried multiple ways of setting the background-color of a DropDownList, but none seem to work.
    >>>>>>> How can the color be set?
    >>>>>>>
    >>>>>>> I've tried setting the BackGroundColor of the DrowDownList component, and also setting it for each of the List
    >>>>>>> Items.
    >>>>>>> The resulting .html code looks correct. Why doesn't the color display?
    >>>>>>>
    >>>>>>> Code
    >>>>>>> DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    >>>>>>> DropDownListWorkLocation.ControlStyle.BackColor = System.Drawing.Color.PowderBlue;
    >>>>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat", "repeat-y");
    >>>>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-color", "powderblue");
    >>>>>>> DropDownListWorkLocation.Items[0].Attributes.Add("style", "color:powderblue");
    >>>>>>> for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    >>>>>>> {
    >>>>>>> DropDownListWorkLocation.Items.Attributes.Add("style", "background-color:powderblue; ");
    >>>>>>> }
    >>>>>>>
    >>>>>>> Resulting HTML
    >>>>>>>
    >>>>>>> <td style="height: 20px;" nowrap="noWrap" width="19%">
    >>>>>>> <select name="DropDownListWorkLocation" id="DropDownListWorkLocation" tabindex="9"
    >>>>>>> style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    >>>>>>> <option selected="selected" value="" style="background-color:powderblue; "></option>
    >>>>>>> <option value="123 Main Street" style="background-color:powderblue; ">123 Main Street</option>
    >>>>>>> <option value="456 Boulevard" style="background-color:powderblue; ">456 Boulevard</option>
    >>>>>>> <option value="789 Avenue" style="background-color:powderblue; ">789 Avenue</option>
    >>>>>>> </select>
    >>>>>>> </td>
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Juan T. Llibre, Nov 15, 2007
    #9
  10. I can see a greenish-blue / aqua / turquoise color. Not dark gray, and not
    the same as PowderBlue displays (here).
    Your scroll bar components look more like PowderBlue.


    "Juan T. Llibre" <> wrote in message
    news:%...
    > Cliff,
    >
    > See PowderBlue rendered in my example at :
    >
    > http://asp.net.do/test/dropdowncolor3.aspx
    >
    > How does that appear when you view it ?
    > Can you see PowderBlue...or do you see dark gray ?
    >
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "Cliff Cotterill" <> wrote in message
    > news:%...
    >>I tried that and background:blue changes the color to blue, but
    >>background:powderBlue displays as dark gray:
    >> DropDownListWorkLocation.Items.Attributes.Add("style",
    >> "background:powderBlue; ");
    >> It looks like it recognizes basic colors like red, blue, white, black
    >> .... but not all of those defined in System.Drawing.Color
    >>
    >>
    >> "Juan T. Llibre" <> wrote in message
    >> news:...
    >>> See PowderBlue rendered in my example at :
    >>>
    >>> http://asp.net.do/test/dropdowncolor3.aspx
    >>>
    >>> That example uses :
    >>>
    >>> DDL1.Items(i).Attributes.Add("style", "background:powderBlue")
    >>>
    >>>
    >>>
    >>>
    >>> Juan T. Llibre, asp.net MVP
    >>> asp.net faq : http://asp.net.do/faq/
    >>> foros de asp.net, en español : http://asp.net.do/foros/
    >>> ======================================
    >>> "Juan T. Llibre" <> wrote in message
    >>> news:%...
    >>>> re:
    >>>> !> That works with red and white, maybe there is a problem with
    >>>> !> System.Drawing.Color.PowderBlue not being recognized ?
    >>>>
    >>>> According to :
    >>>>
    >>>> http://msdn2.microsoft.com/en-us/library/system.drawing.color_properties(VS.80).aspx
    >>>>
    >>>> ...it should be recognized.
    >>>>
    >>>> PowderBlue is a system-defined color.
    >>>>
    >>>> Instead of passing the whole qualified name, try passing just the color
    >>>> name itself:
    >>>>
    >>>> i.e., instead of :
    >>>> System.Drawing.Color.PowderBlue;
    >>>>
    >>>> use :
    >>>> PowderBlue;
    >>>>
    >>>>
    >>>>
    >>>> Juan T. Llibre, asp.net MVP
    >>>> asp.net faq : http://asp.net.do/faq/
    >>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>> ======================================
    >>>> "Cliff Cotterill" <> wrote in message
    >>>> news:...
    >>>>> That works with red and white, maybe there is a problem with
    >>>>> System.Drawing.Color.PowderBlue not being recognized ?
    >>>>>
    >>>>>
    >>>>> "Juan T. Llibre" <> wrote in message
    >>>>> news:e%...
    >>>>>>I should have added that you can set both the background
    >>>>>> and foreground colors in the same style properties, but you know
    >>>>>> that, right ?
    >>>>>>
    >>>>>> Attributes.Add("style", "background: red; color: white;")
    >>>>>>
    >>>>>> ...would give you white letters on a red background.
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>> Juan T. Llibre, asp.net MVP
    >>>>>> asp.net faq : http://asp.net.do/faq/
    >>>>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>>>> ======================================
    >>>>>> "Juan T. Llibre" <> wrote in message
    >>>>>> news:...
    >>>>>>> Hi, Cliff.
    >>>>>>>
    >>>>>>> Use :
    >>>>>>>
    >>>>>>> DropDownListWorkLocation.Attributes.Add("style",
    >>>>>>> "background:powderblue");
    >>>>>>>
    >>>>>>> If you want to apply different colors to different rows, adapt this
    >>>>>>> :
    >>>>>>>
    >>>>>>> If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    >>>>>>> DropDownListWorkLocation.Attributes.Add("style", "background:red")
    >>>>>>> Else
    >>>>>>> DropDownListWorkLocation.Attributes.Add("style",
    >>>>>>> "background:yellow")
    >>>>>>> End If
    >>>>>>>
    >>>>>>> ...or some such variation.
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>> Juan T. Llibre, asp.net MVP
    >>>>>>> asp.net faq : http://asp.net.do/faq/
    >>>>>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>>>>> ======================================
    >>>>>>> "Cliff Cotterill" <> wrote in message
    >>>>>>> news:%...
    >>>>>>>> I've tried multiple ways of setting the background-color of a
    >>>>>>>> DropDownList, but none seem to work.
    >>>>>>>> How can the color be set?
    >>>>>>>>
    >>>>>>>> I've tried setting the BackGroundColor of the DrowDownList
    >>>>>>>> component, and also setting it for each of the List Items.
    >>>>>>>> The resulting .html code looks correct. Why doesn't the color
    >>>>>>>> display?
    >>>>>>>>
    >>>>>>>> Code
    >>>>>>>> DropDownListWorkLocation.BackColor =
    >>>>>>>> System.Drawing.Color.PowderBlue;
    >>>>>>>> DropDownListWorkLocation.ControlStyle.BackColor =
    >>>>>>>> System.Drawing.Color.PowderBlue;
    >>>>>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat",
    >>>>>>>> "repeat-y");
    >>>>>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-color",
    >>>>>>>> "powderblue");
    >>>>>>>> DropDownListWorkLocation.Items[0].Attributes.Add("style",
    >>>>>>>> "color:powderblue");
    >>>>>>>> for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    >>>>>>>> {
    >>>>>>>> DropDownListWorkLocation.Items.Attributes.Add("style",
    >>>>>>>> "background-color:powderblue; ");
    >>>>>>>> }
    >>>>>>>>
    >>>>>>>> Resulting HTML
    >>>>>>>>
    >>>>>>>> <td style="height: 20px;" nowrap="noWrap" width="19%">
    >>>>>>>> <select name="DropDownListWorkLocation"
    >>>>>>>> id="DropDownListWorkLocation" tabindex="9"
    >>>>>>>> style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    >>>>>>>> <option selected="selected" value=""
    >>>>>>>> style="background-color:powderblue; "></option>
    >>>>>>>> <option value="123 Main Street" style="background-color:powderblue;
    >>>>>>>> ">123 Main Street</option>
    >>>>>>>> <option value="456 Boulevard" style="background-color:powderblue;
    >>>>>>>> ">456 Boulevard</option>
    >>>>>>>> <option value="789 Avenue" style="background-color:powderblue;
    >>>>>>>> ">789 Avenue</option>
    >>>>>>>> </select>
    >>>>>>>> </td>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Cliff Cotterill, Nov 15, 2007
    #10
  11. Are you sure you don't suffer from daltonism ?

    <only kidding...>




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Cliff Cotterill" <> wrote in message news:%...
    >I can see a greenish-blue / aqua / turquoise color. Not dark gray, and not the same as PowderBlue displays (here).
    > Your scroll bar components look more like PowderBlue.
    >
    >
    > "Juan T. Llibre" <> wrote in message news:%...
    >> Cliff,
    >>
    >> See PowderBlue rendered in my example at :
    >>
    >> http://asp.net.do/test/dropdowncolor3.aspx
    >>
    >> How does that appear when you view it ?
    >> Can you see PowderBlue...or do you see dark gray ?
    >>
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ======================================
    >> "Cliff Cotterill" <> wrote in message news:%...
    >>>I tried that and background:blue changes the color to blue, but background:powderBlue displays as dark gray:
    >>> DropDownListWorkLocation.Items.Attributes.Add("style", "background:powderBlue; ");
    >>> It looks like it recognizes basic colors like red, blue, white, black .... but not all of those defined in
    >>> System.Drawing.Color
    >>>
    >>>
    >>> "Juan T. Llibre" <> wrote in message news:...
    >>>> See PowderBlue rendered in my example at :
    >>>>
    >>>> http://asp.net.do/test/dropdowncolor3.aspx
    >>>>
    >>>> That example uses :
    >>>>
    >>>> DDL1.Items(i).Attributes.Add("style", "background:powderBlue")
    >>>>
    >>>>
    >>>>
    >>>>
    >>>> Juan T. Llibre, asp.net MVP
    >>>> asp.net faq : http://asp.net.do/faq/
    >>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>> ======================================
    >>>> "Juan T. Llibre" <> wrote in message news:%...
    >>>>> re:
    >>>>> !> That works with red and white, maybe there is a problem with
    >>>>> !> System.Drawing.Color.PowderBlue not being recognized ?
    >>>>>
    >>>>> According to :
    >>>>>
    >>>>> http://msdn2.microsoft.com/en-us/library/system.drawing.color_properties(VS.80).aspx
    >>>>>
    >>>>> ...it should be recognized.
    >>>>>
    >>>>> PowderBlue is a system-defined color.
    >>>>>
    >>>>> Instead of passing the whole qualified name, try passing just the color name itself:
    >>>>>
    >>>>> i.e., instead of :
    >>>>> System.Drawing.Color.PowderBlue;
    >>>>>
    >>>>> use :
    >>>>> PowderBlue;
    >>>>>
    >>>>>
    >>>>>
    >>>>> Juan T. Llibre, asp.net MVP
    >>>>> asp.net faq : http://asp.net.do/faq/
    >>>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>>> ======================================
    >>>>> "Cliff Cotterill" <> wrote in message news:...
    >>>>>> That works with red and white, maybe there is a problem with System.Drawing.Color.PowderBlue not being recognized
    >>>>>> ?
    >>>>>>
    >>>>>>
    >>>>>> "Juan T. Llibre" <> wrote in message news:e%...
    >>>>>>>I should have added that you can set both the background
    >>>>>>> and foreground colors in the same style properties, but you know that, right ?
    >>>>>>>
    >>>>>>> Attributes.Add("style", "background: red; color: white;")
    >>>>>>>
    >>>>>>> ...would give you white letters on a red background.
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>> Juan T. Llibre, asp.net MVP
    >>>>>>> asp.net faq : http://asp.net.do/faq/
    >>>>>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>>>>> ======================================
    >>>>>>> "Juan T. Llibre" <> wrote in message news:...
    >>>>>>>> Hi, Cliff.
    >>>>>>>>
    >>>>>>>> Use :
    >>>>>>>>
    >>>>>>>> DropDownListWorkLocation.Attributes.Add("style", "background:powderblue");
    >>>>>>>>
    >>>>>>>> If you want to apply different colors to different rows, adapt this :
    >>>>>>>>
    >>>>>>>> If ds.Tables(0).Rows(i)("UnitPrice") <= 40 Then
    >>>>>>>> DropDownListWorkLocation.Attributes.Add("style", "background:red")
    >>>>>>>> Else
    >>>>>>>> DropDownListWorkLocation.Attributes.Add("style", "background:yellow")
    >>>>>>>> End If
    >>>>>>>>
    >>>>>>>> ...or some such variation.
    >>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>> Juan T. Llibre, asp.net MVP
    >>>>>>>> asp.net faq : http://asp.net.do/faq/
    >>>>>>>> foros de asp.net, en español : http://asp.net.do/foros/
    >>>>>>>> ======================================
    >>>>>>>> "Cliff Cotterill" <> wrote in message
    >>>>>>>> news:%...
    >>>>>>>>> I've tried multiple ways of setting the background-color of a DropDownList, but none seem to work.
    >>>>>>>>> How can the color be set?
    >>>>>>>>>
    >>>>>>>>> I've tried setting the BackGroundColor of the DrowDownList component, and also setting it for each of the List
    >>>>>>>>> Items.
    >>>>>>>>> The resulting .html code looks correct. Why doesn't the color display?
    >>>>>>>>>
    >>>>>>>>> Code
    >>>>>>>>> DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
    >>>>>>>>> DropDownListWorkLocation.ControlStyle.BackColor = System.Drawing.Color.PowderBlue;
    >>>>>>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-repeat", "repeat-y");
    >>>>>>>>> DropDownListWorkLocation.Attributes.CssStyle.Add("background-color", "powderblue");
    >>>>>>>>> DropDownListWorkLocation.Items[0].Attributes.Add("style", "color:powderblue");
    >>>>>>>>> for (int i = 0; i < DropDownListWorkLocation.Items.Count; i++)
    >>>>>>>>> {
    >>>>>>>>> DropDownListWorkLocation.Items.Attributes.Add("style", "background-color:powderblue; ");
    >>>>>>>>> }
    >>>>>>>>>
    >>>>>>>>> Resulting HTML
    >>>>>>>>>
    >>>>>>>>> <td style="height: 20px;" nowrap="noWrap" width="19%">
    >>>>>>>>> <select name="DropDownListWorkLocation" id="DropDownListWorkLocation" tabindex="9"
    >>>>>>>>> style="font-weight:bold;width:90%;background-repeat:repeat-y;background-color:powderblue;">
    >>>>>>>>> <option selected="selected" value="" style="background-color:powderblue; "></option>
    >>>>>>>>> <option value="123 Main Street" style="background-color:powderblue; ">123 Main Street</option>
    >>>>>>>>> <option value="456 Boulevard" style="background-color:powderblue; ">456 Boulevard</option>
    >>>>>>>>> <option value="789 Avenue" style="background-color:powderblue; ">789 Avenue</option>
    >>>>>>>>> </select>
    >>>>>>>>> </td>
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Juan T. Llibre, Nov 16, 2007
    #11
    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. LeftHorn
    Replies:
    11
    Views:
    1,133
    Blinky the Shark
    Apr 1, 2006
  2. André
    Replies:
    4
    Views:
    481
    André
    Jun 19, 2008
  3. Philip

    default style.backgroundColor value

    Philip, Sep 19, 2003, in forum: Javascript
    Replies:
    1
    Views:
    121
  4. RobG

    backgroundColor and Firefox

    RobG, Nov 3, 2004, in forum: Javascript
    Replies:
    1
    Views:
    127
    Thomas 'PointedEars' Lahn
    Dec 12, 2004
  5. cosmic foo

    backgroundColor

    cosmic foo, Jul 24, 2005, in forum: Javascript
    Replies:
    13
    Views:
    222
    Richard Cornford
    Jul 25, 2005
Loading...

Share This Page