日期:2014-05-19  浏览次数:20382 次

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