We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Rowdatabound or querycellinfo on a listbox ?

Thread ID:





142041 Jan 16,2019 10:31 AM UTC Jan 16,2019 04:28 PM UTC ASP.NET MVC 1
Tags: ListBox
Julien Breton
Asked On January 16, 2019 10:31 AM UTC

Is it possible to add conditionnal color to an item in a list box ? If my item's text is 'Hello' I want the background of the item in a certain color.


Deepa Loganathan [Syncfusion]
Replied On January 16, 2019 04:28 PM UTC

Hi Julien,  
You can achieve this requirement to highlight items with specific text in the create event of Listbox, once the listbox items are rendered and available for customization as given in the below code.  
                dataSource: BikeList, 
                create: create, 
                fields: { id: "empid", value: "text" } 
function create(args){ 
         var list =  $("#selectbike").find("li"); 
           $.map(list, function (obj, index) { 
          if(obj.innerText =="Hello"){ 
<style type="text/css" class="cssStyles"> 
        .highlight { 
            background-color: beige; 
We have prepared a sample for your reference. Please check the below JSPlayground link. 
Deepa L. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon