I am using a RadGrid for displaying the data from a database. I want to change the row color in the RadGrid to red if in the status column that row shows as "REJECTED". If the status is NULL then the row will remain displaying as the color white. I have tried this code but the row still does not change the color to red.
try
{
if (dataBoundItem["status"].Text == "REJECTED")
{
TableCell cell = (TableCell)dataBoundItem["status"];
cell.BackColor = System.Drawing.Color.Red;
dataBoundItem.BackColor = System.Drawing.Color.Red;
if (e.Item is GridDataItem)
{
GridDataItem dataBoundItem1 = e.Item as GridDataItem;
if (dataBoundItem1["Status"].Text != null)
{
cell.BackColor = System.Drawing.Color.Red;
dataBoundItem1.BackColor = Color.Red;
dataBoundItem1["status"].ForeColor = Color.Red;
dataBoundItem1["status"].Font.Bold = true;
}
}
}
}
catch
{ }