This is a migrated thread and some comments may be shown as answers.

Background Color Behavior

6 Answers 141 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Warren
Top achievements
Rank 1
Warren asked on 16 Jul 2009, 08:26 PM
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.

6 Answers, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 17 Jul 2009, 02:44 PM
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.
0
Warren
Top achievements
Rank 1
answered on 17 Jul 2009, 03:02 PM
Thank you Genady.  That worked perfectly.
0
Veselin Vasilev
Telerik team
answered on 17 Jul 2009, 03:05 PM
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.
0
Dan
Top achievements
Rank 1
answered on 01 Apr 2011, 05:50 PM
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.
0
Kate
Telerik team
answered on 07 Apr 2011, 12:43 PM
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
0
Dan
Top achievements
Rank 1
answered on 07 Apr 2011, 05:40 PM
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
Tags
ListBox
Asked by
Warren
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Warren
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Dan
Top achievements
Rank 1
Kate
Telerik team
Share this question
or