0

How can i Change background color of specific values in telerik Combo (MVC).

<%= Html.Telerik().ComboBox()
                            .Name("DropDownList")
                            .BindTo(new SelectList(Model, "ID", "NAME"))
                            .Filterable(filtering =>
                            {
                                filtering.FilterMode(AutoCompleteFilterMode.Contains);
                            })

                            .HtmlAttributes(new {  })
                    %>
tereško
  • 58,060
  • 25
  • 98
  • 150
Zeb-ur-Rehman
  • 1,121
  • 2
  • 21
  • 37
  • i dont think telerik mvc combobox support feature out of the box, make a demo project and post the question on telerik mvc forum with the attached demo project hopefully you will get the response – Dakait Feb 21 '13 at 07:18

2 Answers2

2
function onDataBaound(e) {
            var combobox = $(this).data('tComboBox');
            var str = '<%:Html.Raw(Json.Encode(ViewData["Values"]))%>';
            str = str.replace(/[\[\]']+/g, '');
            str = str.split(',');
            var j = 0;                             
            if (combobox.selectedIndex == -1) {
                var index = -1;
                for (var i = 0; i < combobox.data.length; i++) {
                    if (combobox.data[i].Value == str[j]) {
                        index = i;
                        j++;
                        var $li = $(this).data('tComboBox').dropDown.$items.eq(index);
                        $li.css('color', 'red');                           
                    }
                }
            }              
        }
enigma
  • 82
  • 1
  • 2
  • 11
0

You can alter the brushes associated with the control. If all you are looking to do is change the background color this should be relatively easy. Take a look at this article http://www.telerik.com/help/silverlight/radcombobox-styles-templates-modifying-brushes.html

Mike H.
  • 1,731
  • 9
  • 31
  • 1
    the link you have mentioned is of rad controls the OP has mentioned telerik-mvc in the tags – John x Feb 20 '13 at 18:27