【发布时间】:2013-12-01 05:30:18
【问题描述】:
我有一个 GridView,我想在鼠标悬停该行时更改单元格颜色。我尝试了以下方法:
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#c8e4b6'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
e.Row.Cells[1].Attributes.Add("onmouseover", "this.style.backgroundColor='green'");
e.Row.Cells[1].Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
行颜色变化完美。但只有当鼠标移到该单元格上时,单元格颜色才会发生变化。
当鼠标在行上时,有没有办法改变单元格颜色?
【问题讨论】:
-
为什么你可以在 javascript 中尝试
-
你能帮我做吗?
标签: c# asp.net css gridview onmouseover