ComboBox disabled apperance

8 posts, 0 answers
  1. SSirica
    SSirica avatar
    50 posts
    Member since:
    Jan 2007

    Posted 23 Dec 2008 Link to this post

    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.
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 23 Dec 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lenny_shp
    Lenny_shp avatar
    343 posts
    Member since:
    Jul 2006

    Posted 17 Jun 2009 Link to this post

                .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.
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 18 Jun 2009 Link to this post

    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.
  6. Lenny_shp
    Lenny_shp avatar
    343 posts
    Member since:
    Jul 2006

    Posted 18 Jun 2009 Link to this post

    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 

  7. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 24 Jun 2009 Link to this post

    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.
  8. Lenny_shp
    Lenny_shp avatar
    343 posts
    Member since:
    Jul 2006

    Posted 01 Jul 2009 Link to this post

    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?
  9. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 03 Jul 2009 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017