Private Sub datagrid1_ItemDataBound(ByVal sender As System.Object, ByVal e As DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If e.Item.ItemType = ListItemType.Item Then'============判断行类型
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#9CCBF7'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='WhiteSmoke'")
ElseIf e.Item.ItemType = ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#9CCBF7'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='White'")
End If
If e.Item.ItemType = ListItemType.Item Then'============判断行类型
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#9CCBF7'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='WhiteSmoke'")
ElseIf e.Item.ItemType = ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#9CCBF7'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='White'")
End If