I have some code that will change the background color of a specific label in a GridView, and that works all well and good.
protected void HighLight_Hours(Label Quarter)
{
Int32 Hours;
Int32.TryParse(Quarter.Text, out Hours);
switch (Hours)
{
case 0:
Quarter.BackColor = Color.Red;
break;
case 1:
Quarter.BackColor = Color.Yellow;
break;
case 2:
Quarter.BackColor = Color.LightGreen;
break;
}
}
But instead of calling my function for every single label in my Grid (there are a lot, one for every 15 minutes in a day) is there a way to loop through all the contents of the GridView and set the color accordingly?
This should do it: