Click here to Skip to main content
15,906,708 members

Comments by Member 11659261 (Top 11 by date)

Member 11659261 29-May-23 12:18pm View    
Thanks for all your help, it really is appreciated.

You fixed the listbox highlight colour issue, only the reversion to blue for a selected item in the listbox remains.

I may have to pursuade the client that this isn't an issue given that the highlight colour has been fixed by you.

Thanks again!
Member 11659261 29-May-23 9:19am View    
Unfortunately WebForms doesn't always use the same methods and properties for controls as a .Net Framework website (this site is over 20 years old).

There are a lot of differences between how the controls work and some that have extended properties, etc, in WebForms have fewer methods and properties in a website project.

Also, I'm working on an old site coded entirely in Visual Basic.

I created a new Visual Basic Web Application (.Net Framework) with an Empty project template to try the C# code (converted to Visual Basic) in the updated solution, but it doesn't work.

The listbox still uses the Chrome default colour.
Member 11659261 29-May-23 3:47am View    
It's a web site (e.g. a Web Project), not WebForms or MVC.
Member 11659261 29-May-23 3:10am View    
I'm using .Net Framework v4.7 for a web site, with Google Chrome as the browser (I've also tried FireFox too).
Member 11659261 28-May-23 9:46am View    
Yes, I thought I might have something else interfering with the solution you suggested, so I set up the .aspx page with just two objects, an '<asp:listbox>' and an HTML '<select>' control.

With all other CSS eliminated and just the CSS for the 'listbox' (with the various options) the '<select>' list box works fine - when the item is highlighted it's in the correct colour, but the <asp:listbox> doesn't work in the same way, it retains the Chrome Blue background for the highlighted item.

Finally, I noticed that in the CodePen.io example, when you select an item in the list, then go back to reselect another item the list, the original item is already highlighted in blue, even though none of the code refers to blue for a selected item. This is why I'm thinking that it's a browser issue.