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

[Solved] Partially highlight items based on key

1 Answer 73 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tom Shaeffer
Top achievements
Rank 1
Tom Shaeffer asked on 18 Nov 2009, 04:12 PM
I'm trying to hightlight the RadComboItems with the following code:
(It is simplified to point out my problem; multiple strings "country" will be fetched from the database based on e.Text, obviously).

protected void cbxCountry_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) 
    RadComboBox combo = (RadComboBox)o; 
    combo.Items.Clear(); 
    RadComboBoxItem item = new RadComboBoxItem(); 
    HtmlGenericControl span = new HtmlGenericControl(); 
    string country = "Spain"
    span.InnerHtml = System.Text.RegularExpressions.Regex.Replace(country, e.Text, "<em>" + e.Text + "</em>"); 
    item.Controls.Add(span); 
    item.Text = country; 
    combo.Items.Add(item); 
 

It seems to work; I'm totally free in what content to put in an item, even images.
Unfortunately, it does not highlight when the mouse hovers over the item or when keydown is pressed.
Do I have to <class> attribute somewhere?

1 Answer, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 18 Nov 2009, 04:19 PM
Hi Tom Shaeffer,

Please set the HighlightTemplatedItems property of the RadComboBox to true.

Kind regards,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
Tom Shaeffer
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or