Highlighting a RadDropDownList

7 posts, 1 answers
  1. Mathew
    Mathew avatar
    5 posts
    Member since:
    Jul 2013

    Posted 26 Mar 2014 Link to this post

    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.



  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 Mar 2014 in reply to Mathew Link to this post

    Hi Mathew,

    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">
        .List1 .rddlInner
        {
            color: Red !important;
        }
    </style>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mathew
    Mathew avatar
    5 posts
    Member since:
    Jul 2013

    Posted 27 Mar 2014 in reply to Princy Link to this post

    This works perfectly.  Thanks.
  5. André Coulombe
    André Coulombe avatar
    2 posts
    Member since:
    Jul 2009

    Posted 17 Sep 2014 Link to this post

    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



    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

  6. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 22 Sep 2014 Link to this post

    Hi André,

    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_Windows7 .rddlInner .rddlFakeInput, .RadDropDownList_Windows7 .rddlFocused .rddlFakeInput  {
                color: Red ;
            }
        </sty
    Hope this will help you solve the issue.


    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.

     
  7. André Coulombe
    André Coulombe avatar
    2 posts
    Member since:
    Jul 2009

    Posted 30 Oct 2014 in reply to Plamen Link to this post

    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.

  8. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 31 Oct 2014 Link to this post

    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
     

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017