Users Pricing

forum

Home Forums Change color of row based on value of a column in the row – MindStick

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

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

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md