473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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
1 4904
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: pothik05 | last post by:
Hello I am trying to change the color of individual entry in the listbox control based on some custom event. Can anyone please give any idea how to do it? Thanks
3
by: Chris S | last post by:
I've been unsuccessfully attempting to write a method in Javascript to change an input field from TEXT to SELECT when a user selects (or unselects) a radio button. In my frustration I have been...
3
by: Alpha | last post by:
I have 3 radio buttons for include, exclued or 'select all' from the listbox items. If a user selects the 'Select All' button' then all items in listbox is hi-lited as selected. Now, when user...
2
by: Alpha | last post by:
How do I change the selected item in a listbox according to a Combox's selected item on the same form? The Combox is from a different table in the same dataset as the Listbox uses. Combox's...
2
by: simon | last post by:
I have list box populated with the dataReader. Then I add one item and I want that this item would be the first one in the listBox. Now, It's the last. Can I change the position of the item in the...
10
by: ken | last post by:
Hi, Say I have a list box. I also created a control on a form bound to that list box. When I click different rows in the listbox the control changes the ID of the row depending on what I click. ...
3
by: Mitch | last post by:
Is the following a correct representation of the relationship of the selected index to selected item: INDEX ITEM 0 "item 1" 1 "item 2" 2 "item 3" and so on. I keep...
4
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the...
3
by: CSharper | last post by:
Is it possible to selectivly change the color of an item in text. I saw ForeColor option, but it changes the color of all the items. If it is not possible, is there any other control list listbox...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.