C# 交替显示项的DataGird,鼠标上移时转变颜色,退出后能恢复原来颜色
private void BindGrid()
{
{
for (int i = 0; i < this.dgSmsFilters.Items.Count; i++)
{
this.dgSmsFilters.Items[i].Attributes.Add("onMouseOver", "this.style.backgroundColor='#CDDAFF'");
if (i % 2 == 0) //判断奇偶行数
this.dgSmsFilters.Items[i].Attributes.Add("onMouseOut", "this.style.backgroundColor='#E6EEFF'");
else
this.dgSmsFilters.Items[i].Attributes.Add("onMouseOut", "this.style.backgroundColor='#F5FFFF'");
}
}