Colour coding in ListBox

Q & AColour coding in ListBox
Admin Staff asked 4 years ago

Colour coding in ListBox

1 Answers
Admin Staff answered 4 years ago

for (int i = 0; i < ListBox1.Items.Count; i++)
{
  if(condition)
   {
   ListBox1.Items[i].Attributes.CssStyle.Add(“color”, “green”);
   }
  else ((ds.Tables[0].Rows[i][3].ToString() == “1”) & (ds.Tables[0].Rows[i][2].ToString() == “1”))
   {
    ListBox1.Items[i].Attributes.CssStyle.Add(“color”, “red”);
   }
}