listview highlight row on click

I know how to set up listview to highlight a row when you click a link, image, etc but I am just wondering if it is possible to set it up to highlight a row when you click on any of its cells, not just on a predefined control.

Is that possible?

I way around it would be to setup onclick of each <td> but no idea how to reset the background colour when you click on another cell.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

You could use Jquery on the client side:

$("#myTable tr").click( function () 
   $("#myTable tr").each(function () { $(this).removeClass("selected")}); 

An example fiddle:

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply