use ItemDataBound event of datagrid control
and
private void DataGrid1_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if ( e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem )
{
string color = "";
if ( bool.Parse(e.Item.Cells[0].Text) )
color = "#FF0000";
else
color = "#00FFFF";
for ( int i=0; i < e.Item.Cells.Count; i ++ )
{
e.Item.Cells[i].BackColor = Color.FromName(color);
}
}
}
where in the first column i have the true/false value as a text
Regards
Martin
"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:#H**************@tk2msftngp13.phx.gbl...
How would i format a web data grid conditionally?
If column 1 is the value true i want the row to be white, else if it is
false i want the row to be blue, thanks