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

Background color of DropDownList's selection value box

1 Answer 4678 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 27 Nov 2019, 07:10 PM

How can I set the background color of a DropDownList's selected value box. Adding the following to the DropDownList html helper code: .ValueTemplate("<div style='background-color:yellow'>#= data.Role #</div> results in just the background of the value text being colored yellow. The background of the entire box not behind the value text remains unchanged.

 

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 02 Dec 2019, 11:12 AM

Hello Tom,

You can change the background color of the input field containing the selected value with the bellow CSS:

<style>
    .k-dropdown-wrap {
        background-color: yellow !important;
    }
</style>

The ValueTemplate configuration will append a new div to the span.k-input element. Attached you will find a project showing the result of the above snippet.

Feel free to ask if you have further questions.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Editor
Asked by
Tom
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or