在事件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');");
}
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');");
}