Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3459074
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:03:44+00:00 2026-05-18T10:03:44+00:00

I simply am trying to add a color to the select item background within

  • 0

I simply am trying to add a color to the select item background within the select elm after a user makes a selection from the select elm. The result right now is that in firefox, the colors will change, but only during selection … after the selection has been made the background for the individual selection is still white.

This code works fine in IE but so far my efforts have been thuarted in FireFox. Any suggestions would help.

public static void PerformDDLBackgroundChange(SDropDownList ddl)
    {
        switch ((ComplianceLevel)int.Parse(ddl.SelectedValue))
        {
            case ComplianceLevel.Compliant:
                ddl.SelectedItem.Attributes.Add("class", "Compliant");
                break;
            case ComplianceLevel.OtherThanSerious:
                ddl.SelectedItem.Attributes.Add("class", "OtherThanSerious");
                break;
            case ComplianceLevel.Serious:
                ddl.SelectedItem.Attributes.Add("class", "Serious");
                break;
            case ComplianceLevel.Critical:
                ddl.SelectedItem.Attributes.Add("class", "Critical");
                break;
        }
        ddl.Update();
    }

P.s I made an equivalent javascript method and made some attempts at it, but the result is still the same. The background color of the item is changed … but only is visible when making a selection, NOT after the selection is made.

.Compliant { background-color : #8AC9FF; }

.OtherThanSerious { background-color: #C2FF87; }

.Serious { background-color: #FFBC43; }

.Critical { background-color: #FF6743; }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:03:44+00:00Added an answer on May 18, 2026 at 10:03 am

    Ah I get it.

    I don’t think there is any agreed standard for styling of select elements, it’s genarally seen as bad for usabilty to mess with default OS styles for it.

    However you can change the color on the background if you attach your class directly to the select tag and not to the option tag. But behaviour is probably quite erratic across browsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to simply add a Google Search bar onto my own map
I'm trying to create a simple Add-On for SQL Server 2008; it is simply
Trying to add a color picker to a field in Dynamics AX 2009. Found
If I try to simply add 1.0 to one color-channel of a register, can
I'm trying to calculate how closely an item matches a user's defined preferences. The
I'm trying to make a simple design to select a color and I'm using
I am simply trying to add a separator line under my header row in
I'm trying to add simple login page to ASP.NET MVC app. I actually use
I am trying to add a simple log in with Facebook button to my
I am trying to add a simple form to allow my users to edit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.