By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,696 Members | 2,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,696 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <Ka********@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
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

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.