Hi all
try this example
Protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// This line will get the reference to the underlying row
DataRowView _row = (DataRowView)e.Row.DataItem;
if (_row != null)
{
// get the field value which you want to compare and
// convert to the corresponding data type
// i assume the fieldName is of int type
int _field = Convert.ToInt32(_row.Row["fieldName"]);
if (_field == 7)
e.Row.BackColor = System.Drawing.Color.Green;
else
e.Row.BackColor = System.Drawing.Color.Red;
}
}
}
Good Luck
Friday, November 28, 2008
Subscribe to:
Comments (Atom)

