How to change the Selected Item's forecolor in ListBox-URGENT

Discussion in 'ASP .Net Web Controls' started by Divya, Jul 26, 2005.

  1. Divya

    Divya Guest

    Hi,


    When a listbox's Enabled property is set to false the control is greyed
    out to show that the control is
    disabled/read-only. However, when the control is disabled
    and an item is selected you can barely see the text that
    is selected . Is it possible to change
    the SelectedItem's forecolor to perhaps white and leave
    the unselected ones grey when the control's Enabled
    property is set to false.


    Thanks,
    Divya
     
    Divya, Jul 26, 2005
    #1
    1. Advertising

  2. Divya

    Marcel Guest

    You can use something like:

    <option style="background-color:red">Selected</option>

    Marcel van Eijkel
    (www.vaneijkel.com)
     
    Marcel, Aug 1, 2005
    #2
    1. Advertising

  3. I do belive it is possible, though I haven't tried it :) Something
    like this code should work, though of course you will have to determine
    when to set it, and replace with your own listbox :)

    ListItem itm = myList.Items[ myList.SelectedIndex ];
    itm.Attributes.CssStyle.Add("color:white");

    - Andrew
    <no website to plug>
    ps. post useful answers, M. this is a webcontrols forum.
     
    Andrew Backer, Aug 1, 2005
    #3
    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. =?Utf-8?B?S2FyZW4gR3J1YmU=?=

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

    =?Utf-8?B?S2FyZW4gR3J1YmU=?=, Jun 25, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    942
    Eliyahu Goldin
    Jun 26, 2005
  2. =?Utf-8?B?TWF4IFdlZWJsZXI=?=

    Alternating Item Style "ForeColor" not working in Template Column

    =?Utf-8?B?TWF4IFdlZWJsZXI=?=, Oct 26, 2005, in forum: ASP .Net
    Replies:
    9
    Views:
    929
    =?Utf-8?B?TWF4IFdlZWJsZXI=?=
    Oct 27, 2005
  3. Iain
    Replies:
    3
    Views:
    959
  4. K B
    Replies:
    2
    Views:
    692
  5. mldardy
    Replies:
    0
    Views:
    992
    mldardy
    Sep 28, 2010
Loading...

Share This Page