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

How to change the color of item selection radcombobox with a css style?

7 Answers 1006 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mehdi
Top achievements
Rank 1
Mehdi asked on 11 Dec 2012, 10:08 AM

I was wondering if was possible to change the value of "background-color" for the selection of a radCombobox.


Here is the css code I used:
(I can change everything but not  the color of highlighted items ....)

   
div.RadComboBox_Metro .rcbInputCell INPUT.rcbInput    
{    
background-color: #9BCDFF;
}

"Metro" being the name of the "skin" of my radcombobox

Thanks to all

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 Dec 2012, 11:00 AM
Hi Mehdi,

Try overriding the default CSS using !important as follows to achieve your scenario.

CSS:
<style type="text/css">
    .RadComboBox_Metro .rcbInputCell
    {
        background-color: #9BCDFF !important;
    }
</style>

Hope this helps.

Regards,
Princy.
0
Mehdi
Top achievements
Rank 1
answered on 11 Dec 2012, 12:00 PM
Hello,
Thank you very much for your quick response. But that does not change the color of highlighted items only item being handpicked.
Do you have any idea about it?
0
Princy
Top achievements
Rank 2
answered on 12 Dec 2012, 04:26 AM
Hi Mehdi,

I suppose you want to highlight the selected RadComboBoxItem in the dropdown of RadComboBox. Please take a look into the following code.

JS:
<script type="text/javascript">
    function OnClientSelectedIndexChanged(sender, args) {
        var item = args.get_item();
        item.get_element().style.backgroundColor="#9BCDFF";
    }
</script>

Please elaborate your scenario if it doesn't helps.

Regards,
Princy.
0
Mehdi
Top achievements
Rank 1
answered on 12 Dec 2012, 08:35 AM
This code changes the background correctly in my element! But the background color is changed only when the index selection has changed! and not for the overview (highlight) of my items.
Perhaps there is no solution for this problem. Should be used as a client function ("onClientHighlightedItemChanged") does not exist unfortunately.

I have try this with the "get_highlightedItem()"
but no result..

function cmbx_dbListUserOnClientSelectedIndexChanged(sender, args) {
                        var combo = $find("<%= cmbx_dbListUser.ClientID %>");
                        var highlightItem =  combo.get_highlightedItem();
                        if(highlightItem != null)
                        {
                            highlightItem.style.backgroundColor = "#9BCDFF";
                        }
                    }


0
Mehdi
Top achievements
Rank 1
answered on 12 Dec 2012, 08:58 AM
Finally after a complete headache and several tries. My code below works for the first item highlighted, but not for others .... Have you any idea why?
Thanking you in advance

function cmbx_dbListUserOnClientSelectedIndexChanged(sender, args) {
            var combo = $find("<%= cmbx_dbListUser.ClientID %>");
             var highlightItem =  combo.get_highlightedItem();
             if(highlightItem != null)
              {
                    highlightItem.get_element().style.backgroundColor = "#9BCDFF";
              }
 }
0
Mehdi
Top achievements
Rank 1
answered on 12 Dec 2012, 02:55 PM
Finally,Finally ,Finally ,Finally  after a complete headache and several tries. My code below works !!!

div.RadComboBoxDropDown_Metro .rcbHovered
{
    border: 1px #7FB8FF !important;
    background-color: #7FB8FF !important;
}
.RadComboBox_Metro .rcbFocused .rcbArrowCell, .RadComboBox_Metro .rcbFocused .rcbReadOnly .rcbInputCell, .RadComboBox_Metro .rcbFocused .rcbReadOnly .rcbArrowCellHidden {
    background-color: #7FB8FF !important;
    border: 1px #5B85B7 !important;
}
0
Eon
Top achievements
Rank 1
answered on 05 Apr 2016, 07:38 AM

Thanks Mehdi,

 

Your CSS solution also worked for me.

Tags
TreeView
Asked by
Mehdi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Mehdi
Top achievements
Rank 1
Eon
Top achievements
Rank 1
Share this question
or