How to change the color of the selected item in a web listbox cont

Discussion in 'ASP .Net' started by =?Utf-8?B?S2FyZW4gR3J1YmU=?=, Jun 25, 2005.

  1. Hi!

    I'm using a standard server side ASP.Net listbox control on a web form.
    The page is basically various shades of green. The listbox itself has a pale
    green background and forest green text and a forest green border. However,
    when you move the cursor from one item to the next within the listbox or you
    click on an item in the listbox to select it, the background turns to the
    standard windows dark blue with white letters. Well, that looks ugly. I
    want the background to turn 'forest green' and the characters to turn 'wheat'
    when the item is selected. I already have one app in blue and this one needs
    to be slightly different in design, so I"ve chosen to use shades of green.

    How do I do this without having to completely re-create the whole
    listbox control? I really don't think I should have to do that just to
    control the color of the selected item. The same goes for the listbox
    scrollbars, by the way.

    If there are attributes for setting these colors or 'styles' that I'm
    unaware of, any code samples would be greatly appreciated.

    If there's a free replacement listbox control somewhere that I can
    download that just allows the style of the selected item(s) in a listbox to
    be modified, I'd appreciate knowing about that. Or, if there is a free or
    lowcost one available that also has the capability to define the scrollbar
    colors as well as the selected item color within the control, that would be
    very cool! But only if it's free or very low cost (under $30)

    Please let me know. I seem to be finding this question in a lot of
    forums without good answers! I'm surprised Microsoft hasn't fixed this yet.

    Thanks!
    Karen Grube
     
    =?Utf-8?B?S2FyZW4gR3J1YmU=?=, Jun 25, 2005
    #1
    1. Advertising

  2. Karen,

    1. Make Css classes for selected items with the colors of your choice.
    2. Try to find out what DHTML objects your list is rendered as. use
    browser's "View source" option for that.
    3. Setup client-side onclick events that will change the item styles to the
    classes prepared on stage 1.

    It does take a bit of researching and efforts.

    Eliyahu

    "Karen Grube" <> wrote in message
    news:...
    > Hi!
    >
    > I'm using a standard server side ASP.Net listbox control on a web form.
    > The page is basically various shades of green. The listbox itself has a

    pale
    > green background and forest green text and a forest green border.

    However,
    > when you move the cursor from one item to the next within the listbox or

    you
    > click on an item in the listbox to select it, the background turns to the
    > standard windows dark blue with white letters. Well, that looks ugly. I
    > want the background to turn 'forest green' and the characters to turn

    'wheat'
    > when the item is selected. I already have one app in blue and this one

    needs
    > to be slightly different in design, so I"ve chosen to use shades of green.
    >
    > How do I do this without having to completely re-create the whole
    > listbox control? I really don't think I should have to do that just to
    > control the color of the selected item. The same goes for the listbox
    > scrollbars, by the way.
    >
    > If there are attributes for setting these colors or 'styles' that I'm
    > unaware of, any code samples would be greatly appreciated.
    >
    > If there's a free replacement listbox control somewhere that I can
    > download that just allows the style of the selected item(s) in a listbox

    to
    > be modified, I'd appreciate knowing about that. Or, if there is a free or
    > lowcost one available that also has the capability to define the scrollbar
    > colors as well as the selected item color within the control, that would

    be
    > very cool! But only if it's free or very low cost (under $30)
    >
    > Please let me know. I seem to be finding this question in a lot of
    > forums without good answers! I'm surprised Microsoft hasn't fixed this

    yet.
    >
    > Thanks!
    > Karen Grube
    >
    >
     
    Eliyahu Goldin, Jun 26, 2005
    #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. Renato
    Replies:
    2
    Views:
    6,778
    Renato
    Apr 1, 2004
  2. gelbeiche
    Replies:
    6
    Views:
    460
    CrayzeeWulf
    Apr 25, 2005
  3. Karen Grube
    Replies:
    7
    Views:
    1,432
  4. Karen Grube
    Replies:
    5
    Views:
    552
    Michael Baltic
    Jul 14, 2005
  5. Divya
    Replies:
    2
    Views:
    326
    Andrew Backer
    Aug 1, 2005
Loading...

Share This Page