DataGrid鼠标指向时显示不同颜色

来源:互联网 发布:u盘修复数据恢复 编辑:程序博客网 时间:2024/05/24 04:52
DataGrid鼠标指向时显示不同颜色
private void DataGrid1_ItemDataBound(object sender,System.Web.UI.WebCountrols.DataGridItemEventArgs e)
{
 if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
 {
  e.Item.Attributes.Add("onmouseover","c=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
  e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=c");
 }
}
原创粉丝点击