我是这样写的: Sub DataGrid1_ItemDataBound(Sender As object,e as DataGridItemEventArgs)
Dim nowtime as String nowtime=DateTime.Now.ToString()
if e.item.cells(1).Text=nowtime then e.item.ForeColor=Color.Red end if
End Sub但是有错误说:名称“Color”未声明 请问怎么改?
解决上面的错误 Sub DataGrid1_ItemDataBound(Sender As object,e as DataGridItemEventArgs)
Dim nowtime as String nowtime=DateTime.Now.ToString()
if e.item.cells(1).Text=nowtime then e.item.ForeColor=System.Drawing.Color.Red end if
End Sub
Sub void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) if(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) then
e.Item.Attributes.Add("onmouseover","this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#C8F7FF';"); e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=this.oldcolor;Hide();"); end if End Sub
Sub DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) if(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) then
e.Item.Attributes.Add("onmouseover","this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#C8F7FF';"); e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=this.oldcolor;Hide();"); end if End SubVB根C#又没什么区别自己随便改改就行了、、、
{
if(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
e.Item.Attributes.Add("onmouseover","this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#C8F7FF';");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=this.oldcolor;Hide();");
}
}
Sub DataGrid1_ItemDataBound(Sender As object,e as DataGridItemEventArgs)
Dim nowtime as String
nowtime=DateTime.Now.ToString()
if e.item.cells(1).Text=nowtime then
e.item.ForeColor=Color.Red
end if
End Sub但是有错误说:名称“Color”未声明
请问怎么改?
Sub DataGrid1_ItemDataBound(Sender As object,e as DataGridItemEventArgs)
Dim nowtime as String
nowtime=DateTime.Now.ToString()
if e.item.cells(1).Text=nowtime then
e.item.ForeColor=System.Drawing.Color.Red
end if
End Sub
if(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) then
e.Item.Attributes.Add("onmouseover","this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#C8F7FF';");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=this.oldcolor;Hide();");
end if
End Sub
if(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) then
e.Item.Attributes.Add("onmouseover","this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#C8F7FF';");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=this.oldcolor;Hide();");
end if
End SubVB根C#又没什么区别自己随便改改就行了、、、