You can use the Rows
property of gridview
to select the entire row instead of column by column. I show a simplified version of a method that I use for such a reason:
protected void PintarGrid(GridView grid, int fila)
{
grid.Rows[fila].BackColor = Color.Red;
}
Update
You can go through the grid row by row, and check for each row if the stock column is at 0, like this:
protected void PintarGrid(GridView grid, int indiceColumna)
{
for (int indiceFila = 0; indiceFila < grid.Rows.Count; indiceFila++)
{
TableCell campo = grid.Rows[indiceFila].Cells[indiceColumna];
if (campo.Text.Equals("0"))
{
grid.Rows[indiceFila].BackColor = Color.Red;
}
}
}