_小向

导航

datagrid

DataGrid鼠标随行变色

  在ItemDataBound中添加以下代码:

1 if(e.Item.ItemType!=ListItemType.Header)
2 {    
3  e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='#CFF3F7'; ");
4  e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='"+     e.Item.Style["background-color"]  +"';");
5 }
View Code

 

 

posted on 2013-12-24 10:46  _小向  阅读(134)  评论(0)    收藏  举报