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

D

Divya

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
 
A

Andrew Backer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top