读书人

GridView单击改变背色后再单击其它行如

发布时间: 2012-02-21 16:26:23 作者: rapoo

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

读书人网 >asp.net

热点推荐