I have tried following this article but doesnt not work for me. In my situation i have gridview with few hiddenfields. One of which has the value of either Y or N. I would like to change background for the record that has value of Y.
I was trying the following:
if (e.Row.RowType == DataControlRowType.DataRow)
{
//((HiddenField)getItemDesc.SelectedRow.Cells[1].FindControl("HiddenFieldID")).Value;
var status = char.Parse(e.Row.Cells[22].Text);
foreach (TableCell cell in e.Row.Cells)
{
if (status == 'Y')
{
cell.BackColor = Color.Yellow;
}
}
}
I get the following error:
String must be exactly one character long.
Please help. All im trying to do is get value from hiddenfield and change color.
Thank You