hovering over gridview row overrides alternating row style
below is the code that works fine but the only problem i have is : overriding the alternative row with backgroundColor='white'
how can i have my alternative color when onmouseout
?
<AlternatingRowStyle BackColor="#DEEEE9" Font-Size="8pt" />
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "th开发者_Python百科is.style.backgroundColor='#C2D69B'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
e.Row.Attributes.Add("style", "cursor:pointer;");
}
While I'm not a fan of setting these in the code-behind, I think something these lines would take care of you:
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');");
精彩评论