Background Color Behavior

7 posts, 1 answers
  1. Warren
    Warren avatar
    7 posts
    Member since:
    Sep 2008

    Posted 16 Jul 2009 Link to this post

    I notice that setting the background color of the RadListBox does not actually change the background color within the list area of the listbox.  The background color is only changed in the button area which is not the desired behavior.  I have controls on a web form and would like them all to have a consistent background color, but I don't seem to be able to achieve that just yet.

    Using IE 8 and IE 8 Compatibility Mode for IE 7.
  2. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 17 Jul 2009 Link to this post

    Hello Warren,

    You can use the following CSS to force set the background color of the RadListBox:

         
    <style type="text/css"
        .RadListBox div.rlbGroup 
        { 
            background-color:Aqua; 
        }  
        </style> 


    Sincerely yours,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Warren
    Warren avatar
    7 posts
    Member since:
    Sep 2008

    Posted 17 Jul 2009 Link to this post

    Thank you Genady.  That worked perfectly.
  5. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 17 Jul 2009 Link to this post

    Hi Warren,

    When you set the BackColor property of RadListBox it is rendered to the outer DIV element of the control. The Skin sets the background color to the inner DIV and that overrides it.

    So, to set the background color I suggest that you override the CSS rule of the skin by adding the following CSS rule to the <head> section of your page:

    <style type="text/css"
    div.RadListBox_Default .rlbGroup { 
        background-color : Gray;         
    </style> 

    Just replace Default with the name of your skin.

    Greetings,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Dan
    Dan avatar
    124 posts
    Member since:
    Feb 2011

    Posted 01 Apr 2011 Link to this post

    Is there a way to set the BackColor on the server-side?  

    I have an application scenario where I would like to set the background-color of a ListBox to a different color to indicate that it is a required field - a configurable option that is checked in the database, and rendered via an AJAX call.
  7. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 07 Apr 2011 Link to this post

    Hi Dan,

    You can set the user defined class class1 from the code behind in the following way. I also included the definition of the css class:
    RadListBox1.CssClass = "class1";

    div.class1 .rlbGroup
          {
               background-color:Red;
          }



    All the best,
    Kate
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Dan
    Dan avatar
    124 posts
    Member since:
    Feb 2011

    Posted 07 Apr 2011 Link to this post

    Thank you Kate. As I am using an HTML table in my dropdown, I was able to get it working with the CssClass="myClass" and the definition like this:

    .myClass td, .myClass {
          background-color: #fff;    
          color: #ccc;
    }

    I will take a look at the rlbGroup class and see if that would work better for my purposes
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017