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

How do I add a ComboBox custom icon?

2 Answers 681 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jeff
Top achievements
Rank 1
Jeff asked on 20 Apr 2011, 01:48 PM
Hi - I'm looking to add a search icon to the right in my combo box (right before the dropdown arrow, similar to the look of the google toolbar).  I tried adding a css class like this...

.search-combo-box
{
    background-image: url('Images/Search-icon.png');
    background-repeat: no-repeat;
    background-position: right;
}

Then on my combo box, I set the class...

.HtmlAttributes( new { @class = "search-combo-box" } )

But the icon isn't showing up.   I'm assuming this is something simple I'm missing.  Has anyone done something similar before?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 20 Apr 2011, 02:52 PM
Hi Jeff,

You should define your CSS selector like this:

.search-combo-box  .t-input
{
    /* ... */
}

This is because the custom CSS class is applied to the ComboBox wrapper, while the custom background image needs to be set for the textbox inside the wrapper. You cannot define a custom background image for the component's wrapper, because the native appearance will be spoiled.
Regards,
Dimo
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
Jeff
Top achievements
Rank 1
answered on 20 Apr 2011, 03:04 PM
Thanks Dimo!  That worked great...

.search-combo-box .t-input
{
    background-image: url('Images/Search-icon.png');
    background-repeat: no-repeat;
    background-position: right;
}
Tags
ComboBox
Asked by
Jeff
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or