I have an sqldatasource that loads, data from my server and puts it in a datagrid.
What I want is that each row have a different color depending on which number is in that datarow column
$(document).ready(function () {
$("#<%=GridView1.UniqueID%> tr").each(function () {
var number = $(this).children('td:eq(6)').text();
if (number == 'OK') {
$(this).children('td').css({ "background-color": "lightgreen" });
}
})
});
Sumit Kesarwani
23-Aug-2014Granted you've given your gridview a css class called 'myGridView' you could do the following:
where 'td:eq(1)' refers to the second cell in a row. This of course will depend on what cell in your row contains this magic number.
I'm certain it's not the most elegant use of jQuery, but you could refactor it as you wish.