Set DisabledStyle in Code Behind

2 posts, 0 answers
  1. Darren
    Darren avatar
    20 posts
    Member since:
    Sep 2011

    Posted 13 Mar 2013 Link to this post

    How do you set the DisabledStyle for a ComboBox in Code Behind?

    I tried this but it didn't work:
    [ToolboxData("<{0}:RadComboBoxEx runat='server'></{0}:RadComboBoxEx>")]
    public class RadComboBoxEx : RadComboBox
        public RadComboBoxEx()
            : base()
            //this.DisabledStyle.BackColor = System.Drawing.Color.White;
            //this.DisabledStyle.ForeColor = System.Drawing.Color.LightGray;
            this.Init += new EventHandler(RadComboBoxEx_Init);
        void RadComboBoxEx_Init(object sender, EventArgs e)
        private void SetDisabledStyle(ControlCollection controlCollection)
            foreach(Control control in controlCollection)
                if ( control is RadInputControl )
                    RadInputControl input = (RadInputControl)control;
                    input.DisabledStyle.BackColor = System.Drawing.Color.White;
                    input.DisabledStyle.ForeColor = System.Drawing.Color.LightGray;
  2. Nencho
    Nencho avatar
    1880 posts

    Posted 15 Mar 2013 Link to this post

    Hello Darren,

    I can suggest you to apply the disabled style of the RadComboBox in the following manner :

    RadComboBox1.InputCssClass = "rcbReadOnly";

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top