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

No Border or Background

3 Answers 261 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tye
Top achievements
Rank 1
Tye asked on 24 Feb 2010, 11:39 PM
Greetings. I've searched through the forums but haven't been able to find the perfect solution to what I need. Basically, I need for the ComboBox (using the Office 2007 theme) to have no border and no background behind the arrow when it's collapsed (closed), but when hovered over retains all the normal Office 2007 styles (including border and background). I've managed to get rid of the border, but the arrow continues to cause problems. My hunch is it has something to do with the sprites and the background-position, but I'm not 100% sure. Can someone please assist?

Many thanks,

Tye

3 Answers, 1 is accepted

Sort by
0
Accepted
Kamen Bundev
Telerik team
answered on 02 Mar 2010, 01:14 PM
Hello Tye,

The RadComboBox borders and background are made entirely from images (at least in Q1 2009+), so you can hide the RadComboBox's appearance until you hover by creating an external skin or by using some javascript and the internal skin. Check the javascript solution below:

Create a rule with which to hide the borders and backgrounds:
<style type="text/css">
    div.NoBorder .rcbInputCell,
    div.NoBorder .rcbArrowCell
    {
        background: none;
    }
</style>

Bind the events with which to add and remove the rule:
<script type="text/javascript">
    function pageLoad() {
        $telerik.$('.NoBorder')
            .bind('mouseover', function () {
                $telerik.$(this).removeClass('NoBorder');
            })
            .bind('mouseout', function () {
                if ($telerik.$('.rcbFocused', this).length == 0) {
                    var item = $telerik.$(this);
                    if (!item.hasClass('NoBorder'))
                        item.addClass('NoBorder');
                }
            });
    }
    function onNoBorderBlur(sender) {
        var item = $telerik.$(sender.get_element());
        if (!item.hasClass('NoBorder'))
            item.addClass('NoBorder');
    }
</script>

And finally define your RadComboBox like this:
<telerik:RadComboBox runat="server" Skin="Office2007" CssClass="NoBorder" OnClientBlur="onNoBorderBlur" >

Let me know if this works for you.

Regards,
Kamen Bundev
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
Tye
Top achievements
Rank 1
answered on 02 Mar 2010, 04:13 PM
Thanks for the response Kamen. That was a big help. I ended up tweaking the CSS a bit to get the desired effect:

div.NoBorder .rcbInputCell 
    backgroundnone
div.NoBorder .rcbArrowCell 
    background-position: -159px -88px !important; 
div.NoBorder.RadComboBox_Office2007 .rcbHovered 
    border1px solid #c6c7d2 !important; 
    background-color: White !important; 
div.NoBorder.RadComboBox_Office2007 .rcbFocused 
    background-color: White !important; 
    border1px solid #c6c7d2 !important; 
 

The sprite for the combo box had the right arrow, so setting the background-position fixed the arrow problem. So now, when collapsed, the arrow has no background (all you see is the dark-blue arrow), but when hovered, has the orange background that's a part of the Office2007 skin. 

Thanks for the help!
0
Kamen Bundev
Telerik team
answered on 03 Mar 2010, 09:51 AM
Hi Tye,

Great! However, be aware that such selectors - div.NoBorder.RadComboBox_Office2007 - won't work in IE6. Since you are setting the CssClass yourself, you don't actually need the .RadComboBox_Office2007 part so you can just remove it and it will work everywhere.

Greetings,
Kamen Bundev
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.
Tags
ComboBox
Asked by
Tye
Top achievements
Rank 1
Answers by
Kamen Bundev
Telerik team
Tye
Top achievements
Rank 1
Share this question
or