您的位置:首页 > 其它

如何使鼠标经过datagrid的列时,该列背景色改变

2006-04-22 10:01 288 查看
在事件ItemDataBound中添加下面的代码段:
if (e.Item.ItemType ==ListItemType.Item || e.Item.ItemType ==ListItemType.AlternatingItem )
{
e.Item.Attributes.Add("onmouseover","this.setAttribute('BKC',this.style.backgroundColor); this.style.cursor='hand';this.style.backgroundColor='Green'");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=this.getAttribute('BKC');");
e.Item.Attributes.Add("onmousedown","this.style.cursor='hand';this.style.backgroundColor='red'");
e.Item.Attributes.Add("onmouseup","this.style.backgroundColor=this.getAttribute('BKC');");
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: