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

Change style when DropDownList.Enabled = false

3 Answers 1480 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
michael schneider
Top achievements
Rank 1
michael schneider asked on 27 Mar 2013, 03:55 PM

Hello,

On my page I have some DropDownLists (created in codebehind) that works great .

Skin: Default

When there is no DropDownListItem in the DropDownList, I set myDdl.Enabled = false;

I want change the style for the disabled DropDownList:
color:  lightgrey
border: lightgrey
image on the right side: lightgrey

How can I achive this?

thanks
Bernie

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Mar 2013, 06:36 AM
Hi,

Please check the sample code I tried at my end.

C#:
if (dropDownlist1.Items.Count==0)
{
    dropDownlist1.Enabled = false;
    dropDownlist1.CssClass = "disabledStyle";
}
else
{
    dropDownlist1.Enabled = true;
    dropDownlist1.CssClass = "enabledStyle";
}

CSS:
<style type="text/css">
    .disabledStyle
    {
        border: 1px solid gray;
        color: Gray;
    }
    .enabledStyle
    {
        border: 1px solid Blue;
    }
</style>

Thanks,
Princy.
0
michael schneider
Top achievements
Rank 1
answered on 28 Mar 2013, 09:07 AM

Hello,

thanks, but that colors only an extra outer frame of the frame with the rounded corners (Image 1).

What  I want is to grey the text and the frame with the rounded corners  (Image 2 --> first empty DropDownList).
Here I set:
  DropDownList1.DefaultMessage = "<div style='color:#dddddd'>-------------------------</div>";
 
 
Any ideas?


Bernie
0
Nencho
Telerik team
answered on 02 Apr 2013, 08:20 AM
Hello Bernhard,

I would recommend you to download our latest internal build from today, which would apply the rddlDisabled class to the RadDropDownList, when it is disabled. In addition, you could use the following css style, in order to achieve the desired functionality:

html .RadDropDownList_Default .rddlDisabled {
           border-color: #cccccc;
       }

Please note, that the down-arrow could not be styled, since we are currently working on providing the appropriate css sprite image, addressing different styles and colors.

Regards,
Nencho
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.
Tags
DropDownList
Asked by
michael schneider
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
michael schneider
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or