Hi,
I have a gridview in asp.net,getting just three columns of text. I want to check in each row if the value "alarm" is in one of the columns, and if so colour the whole row yellow. I sort of got this to work when comparing an integer but cannot get it to work when comparing text. What would be your approach in c#. Here my code attached, I am trying to mod it from comparing int value code but i'm stuck. Any help would be appreciated., Thanks. Harry.
integer result code trying to change to suit text search:
protected void productsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// determine the value of the UnitsInStock field
int unitsInStock =
Convert.ToInt32(DataBinder.Eval(e.Row.DataItem,
"strShift"));
if (unitsInStock.ToString()=="Alarm");
// color the background of the row yellow
e.Row.BackColor = Color.Yellow;