Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Help!!!!! Changing the background color of dropdownlist in the aspx.cs

Help!!!!! Changing the background color of dropdownlist in the aspx.cs

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jinnyb
    wrote on last edited by
    #1

    I have a dropdownlist box which displays the status of the Cities whether it is active or inactive .I want to change the background color of the selected item ,say if it is active then the back color should be green and fore-color black.When the status is inactive the back color should be red and fore-color should be black .By the way to make it very specific i am not fill the dropdownlist from database i m filling it manually uisng items.add method in the aspx.cs page . Kindly tell me how can i add color to the items of my dropdownlist Patel Neelesh A

    A M 2 Replies Last reply
    0
    • J jinnyb

      I have a dropdownlist box which displays the status of the Cities whether it is active or inactive .I want to change the background color of the selected item ,say if it is active then the back color should be green and fore-color black.When the status is inactive the back color should be red and fore-color should be black .By the way to make it very specific i am not fill the dropdownlist from database i m filling it manually uisng items.add method in the aspx.cs page . Kindly tell me how can i add color to the items of my dropdownlist Patel Neelesh A

      A Offline
      A Offline
      adi12
      wrote on last edited by
      #2

      use the ddl properties in the main code to change the back or fore color of the ddl. use properties like dropdownlist.backcolor.green and dropdownlist.forecolor.black when u have the cities active. by enclosing the statements in a if condition. if active =1 then dropdownlist.backcolor.green dropdownlist.forecolor.black end if

      1 Reply Last reply
      0
      • J jinnyb

        I have a dropdownlist box which displays the status of the Cities whether it is active or inactive .I want to change the background color of the selected item ,say if it is active then the back color should be green and fore-color black.When the status is inactive the back color should be red and fore-color should be black .By the way to make it very specific i am not fill the dropdownlist from database i m filling it manually uisng items.add method in the aspx.cs page . Kindly tell me how can i add color to the items of my dropdownlist Patel Neelesh A

        M Offline
        M Offline
        Mattias Olgerfelt
        wrote on last edited by
        #3

        Hi, I am sorry to say this, but there is a bug in the rendering attributes in the dropdownlist. see: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q309338[^] /Mattias

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups