public void DatagridColorBasedOnVal()
{
try
{
foreach (DataGridViewRow row in dgvroomStatus.Rows)
{
if (row.Cells["RoomStatus"].Value != null)
{
if (row.Cells["RoomStatus"].Value.ToString() == "Vacant")
{
row.DefaultCellStyle.BackColor = Color.FloralWhite;
}
else if (row.Cells["RoomStatus"].Value.ToString() == "Occupied")
{
Color colour = ColorTranslator.FromHtml("#09F891");
row.DefaultCellStyle.BackColor = colour;//Color.;
}
else if (row.Cells["RoomStatus"].Value.ToString() == "Reserved")
{
Color colour = ColorTranslator.FromHtml("#E0FFFF");
row.DefaultCellStyle.BackColor = colour;
}
}
}
}
catch (Exception ex) { ex.ToString(); }
}