I have several RadDropDownLists on the same page. I would like to bring attention to one of them programmatically, for example by changing the background or foreground color. What is the simplest correct way to make a minor style change to a single control? I can do this successfully with a RadTextBox on the same page by setting its CssClass property.
I have tried setting the ForeColor, BackColor, and CssClass properties of my RadDropDownList, but the specificity of built-in styles for .RadDropDownList_Default .rddlInner seems to override any changes I can make.
I have tried setting the ForeColor, BackColor, and CssClass properties of my RadDropDownList, but the specificity of built-in styles for .RadDropDownList_Default .rddlInner seems to override any changes I can make.
6 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 27 Mar 2014, 04:43 AM
Hi Mathew,
Please try the following sample code snippet which works fine at my end.
ASPX:
CSS:
Thanks,
Princy.
Please try the following sample code snippet which works fine at my end.
ASPX:
<
telerik:RadDropDownList
ID
=
"RadDropDownList1"
runat
=
"server"
CssClass
=
"List1"
>
<
Items
>
<
telerik:DropDownListItem
Text
=
"1"
/>
<
telerik:DropDownListItem
Text
=
"2"
/>
</
Items
>
</
telerik:RadDropDownList
>
CSS:
<style type=
"text/css"
>
.List
1
.rddlInner
{
color
: Red
!important
;
}
</style>
Thanks,
Princy.
0
Mathew
Top achievements
Rank 1
answered on 27 Mar 2014, 02:39 PM
This works perfectly. Thanks.
0
André Coulombe
Top achievements
Rank 1
answered on 17 Sep 2014, 08:19 PM
Hi,
It does not work for me. Here what I get as Trace Styles from the Page Inspector. The last style is the one that is applied. My style is modifiedField and it is overrided by 2 other Telerik styles. I tried several modification for my style, but no luck. Someone has an idea? Thanks
It does not work for me. Here what I get as Trace Styles from the Page Inspector. The last style is the one that is applied. My style is modifiedField and it is overrided by 2 other Telerik styles. I tried several modification for my style, but no luck. Someone has an idea? Thanks
color rgb(30, 57, 91)
<
div
> .RadDropDownList_Windows7 black Telerik.Web.UI.WebResource.axd
<
span
> .modifiedField .rddlFocused gold StyleSheet1.css
<
span
> .RadDropDownList_Windows7 .rddlInner rgb(30, 57, 91) Telerik.Web.UI.WebResource.axd
<
span
> .RadDropDownList_Windows7 .rddlFocused rgb(30, 57, 91) Telerik.Web.UI.WebResource.axd
0
Hi André,
you could either use !important as in the code provided by Princy or a more specific CSS rule as below:
Hope this will help you solve the issue.
Regards,
Plamen
Telerik
you could either use !important as in the code provided by Princy or a more specific CSS rule as below:
<style type=
"text/css"
>
.RadDropDownList_Windows
7
.rddlInner .rddlFakeInput, .RadDropDownList_Windows
7
.rddlFocused .rddlFakeInput {
color
: Red ;
}
</sty
Regards,
Plamen
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
André Coulombe
Top achievements
Rank 1
answered on 30 Oct 2014, 07:36 PM
Thanks.for your help.
It did not worked for me because I trying to change the color of a dropdown menu, and the only way to do this was to provide a new skin. So, I set a custom to the control when I want it in a different color.
It did not worked for me because I trying to change the color of a dropdown menu, and the only way to do this was to provide a new skin. So, I set a custom to the control when I want it in a different color.
0
Hi,
In case of custom skin you could either replace the Window7 selector with the name of your custom skin or completely remove this selector.
Regards,
Plamen
Telerik
In case of custom skin you could either replace the Window7 selector with the name of your custom skin or completely remove this selector.
Regards,
Plamen
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.