Styling the RadAutoCompleteBox

Telerik has a pretty cool control called a RadAutoCompleteBox that acts kind of like the Google search bar. 

I'm trying to style the items in the list so that some of the entries have a different format (the box displays items, and I want the discontinued ones to be red)

I emailed support, and the answer is below

 

Related Articles

... and you 'll find more on the Telerik ASPNET Menu

function onDropDownOpened(sender, args) {
    var dropDown = sender.get_dropDownElement();
    var list = dropDown.querySelector("ul");
    var itemCollection = list.childNodes;
 
    itemCollection.forEach((item) => {
        var isDiscontinued = getIsDiscontinued(item); // Assuming you have logic to check if an item is discontiued
 
        if (isDiscontinued) {
            item.style.backgroundColor = "red";
        }
    })
}
 
function getIsDiscontinued(item) {
    if (item.textContent.includes("n")) { // Just for demonstration, replace with actual logic
        return true;
    }
 
    return false;
}

 

RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences