forum

Home / DeveloperSection / Forums / Change color of row based on value of a column in the row

Change color of row based on value of a column in the row

Anonymous User 1438 23-Aug-2014

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" });
        }
    })
});

Updated on 23-Aug-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By