Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to change the color of the selected item in a web listbox cont

Reply
Thread Tools

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

 
 
=?Utf-8?B?S2FyZW4gR3J1YmU=?=
Guest
Posts: n/a
 
      06-25-2005
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


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-26-2005
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:BCE53618-4EEB-4D53-946D-...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change the Selected Item's forecolor in ListBox-URGENT Divya ASP .Net Web Controls 2 08-01-2005 08:41 PM
REPOST: How can I change the color of the Selected Item in a list Karen Grube ASP .Net Web Controls 5 07-14-2005 08:29 PM
empty vs. cont.begin() == cont.end() gelbeiche C++ 6 04-25-2005 10:44 PM
Changing the background color of the selected item in a listbox. Karen Grube ASP .Net Web Controls 7 03-17-2005 11:05 PM
Change color of an item in a listbox Renato ASP .Net 2 04-01-2004 01:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57