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

ComboBox disabled apperance

7 Answers 297 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
SSirica asked on 23 Dec 2008, 03:05 PM
Why is it so difficult to alter the apperance of a combobox control when it's disabled?  I've tried every example I found here in the forum and my combobox looks the same every time.  I'm using the Vista skin, and I'm trying to get rid of the controls borders.  This shouldn't be this hard.

7 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 23 Dec 2008, 03:46 PM
Hello Steve,

When you disable RadCombobobox, the rcbDisabled class is applied to its table and opacity is set:

.RadComboBox_Vista .rcbDisabled
{
    opacity:0.5;
}

You can still change the appearance of the disabled combobox, but as for the borders, they are part of the backgound image used in the skin so you cannot get rid of them unless you modify the images from the skin.

Regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lenny_shp
Top achievements
Rank 2
answered on 17 Jun 2009, 08:27 PM
            .RadComboBox_Outlook .rcbDisabled .rcbInputCell 
            { 
                background-color:Gray; 
                color:Black; 
            } 

2009.1.609.35


The above doesn't make a difference.   I would like to change the disabled combobox to look like readonly Textbox with gray background and black foreground.    Currently the user complains that the light gray is hard to read.

Thanks.
0
Simon
Telerik team
answered on 18 Jun 2009, 08:22 AM
Hello Lenny_shp,

While this style works in FireFox for instance, it does not in IE - more specifically you could not change the font style in IE, it depends on the current Windows Theme.

So, please choose an appropriate background and use it instead of the default one. Optionally you could add the fore-color to achieve the full effect in browsers other than IE.

Greetings,
Simon
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Lenny_shp
Top achievements
Rank 2
answered on 18 Jun 2009, 01:24 PM
Any reason you cannot implement RadCombo in the disabled state to render it as a ReadOnly textbox?  

<input name="txtInitiator" type="text" value="xyz" readonly="readonly"

The workaround I came up with is to leave it enabled, remove all items except selected.  Not preferred though!

               .BackColor = Drawing.Color.Gainsboro 
                    '.ForeColor = Drawing.Color.Black   'This doesn't do anything for IE 
                    .ShowDropDownOnTextboxClick = False 
 
                    '.Enabled = False   'DWR due to RadComboBox's rendering for disabled we left it enabled with selected item only 
                    Dim tmpItem As RadComboBoxItem = .SelectedItem 
                    If tmpItem IsNot Nothing Then                         
                        .Items.Clear() 
                        .Items.Add(tmpItem) 
                        tmpItem.Selected = True 
                    End If 

0
Simon
Telerik team
answered on 24 Jun 2009, 12:32 PM
Hello Lenny_shp,

Changing the current rendering of RadComboBox will require many other changes in its functionality, which is not desirable having in mind the fact that other customers are using the current behavior and this may break their pages.

There is a workaround however, although it does not produce exactly the same effect as desired. In any case, here is the code if you are interested in giving it a try:

function setDisable(event) { 
    var table = this.parentNode.parentNode.parentNode.parentNode; 
    var input = this
 
    setTimeout(function() { 
        table.focus(); 
        table.className = 'rcbDisabled'
    }, 1); 
}; 
 
function disableCombo(id) { 
    var $ = $telerik.$; 
 
    var el = $find(id); 
    var input = $('#' + id + ' > table input'); 
     
    el.disable(); 
    input.removeAttr('disabled'); 
    input.bind('focus', setDisable).bind('blur', setDisable); 
    el.disableEvents(); 

Please feel free to adjust the code to achieve the desired effect.

Kind regards,
Simon
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Lenny_shp
Top achievements
Rank 2
answered on 01 Jul 2009, 01:16 PM
Thanks, how do I hook up the disabled event to call the client functions you provided?

How about implementing a ReadOnly property that will display with what you proposed?
0
Simon
Telerik team
answered on 03 Jul 2009, 10:33 AM
Hi Lenny_shp,

You could call the disableCombo function, passing the correct ComboBox ClientID whenever you find appropriate (or is needed).

For instance, if certain conditions at the server-side are met, you could emit a script, which calls the disableCombo function.

Regarding the ReadOnly functionality you are referring to, it would require major modifications of the existing code and changing many internal aspects of RadComboBox. This could break existing implementations using the control, so it is more likely that we preserve the current behavior.

Sincerely yours,
Simon
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
Tags
ComboBox
Asked by
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Peter
Telerik team
Lenny_shp
Top achievements
Rank 2
Simon
Telerik team
Share this question
or