2011-02-15 53 views
0

下面是可以正常工作的代码,但唯一的问题是:覆盖替代行backgroundColor='white'如何在onmouseout时替代颜色?悬停在gridview行覆盖交替行样式

<AlternatingRowStyle BackColor="#DEEEE9" Font-Size="8pt" /> 

if (e.Row.RowType == DataControlRowType.DataRow) 
{ 
    e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#C2D69B'"); 
    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); 
    e.Row.Attributes.Add("style", "cursor:pointer;"); 
} 

回答

1

虽然我不是在代码隐藏设置这些球迷,我觉得这些东西线将照顾你:

e.Row.Attributes.Add("onmouseover", "this.setAttribute('bgColor', this.style.backgroundColor); this.style.backgroundColor = '#C2D69B';"); 
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor = this.getAttribute('bgColor');"); 
+0

不会做任何事情 – 2011-02-15 18:08:36