如何让DataGrid的前3行变成红色的
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==System.Web.UI.WebControls.ListItemType.Item||e.Item.ItemType==System.Web.UI.WebControls.ListItemType.AlternatingItem)
{
if(e.Item.ItemIndex<4)
{
e.Item.BackColor=System.Drawing.Color.Red;
}
}
}