当前位置: 代码迷 >> ASP.NET >> GridView单击改变背色后再单击其它行如何把以前这一行的颜色还原
  详细解决方案

GridView单击改变背色后再单击其它行如何把以前这一行的颜色还原

热度:6586   发布时间:2013-02-26 00:00:00.0
GridView单击改变背色后再单击其它行怎么把以前这一行的颜色还原?
如题
或改变成其它颜色也可以

------解决方案--------------------------------------------------------
if (e.Item.ItemType == ListItemType.Item)
{
e.Item.Attributes.Add( "onmouseover ", "this.style.backgroundColor= '#9CCBF7 ' ");
e.Item.Attributes.Add( "onmouseout ", "this.style.backgroundColor= 'WhiteSmoke ' ");
}
if (e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.Attributes.Add( "onmouseover ", "this.style.backgroundColor= '#9CCBF7 ' ");
e.Item.Attributes.Add( "onmouseout ", "this.style.backgroundColor= 'White ' ");
}