在.NET2.0中,使用C#语言编程 ,用onmouseover后数据行不变色。代码如下:

来源:百度知道 编辑:UC知道 时间:2024/06/02 16:44:50
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style,backgroundColor='#00ffee';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
}

这样就行了,是
("onmouseover", "c=this.style.backgroundColor;this.style,backgroundColor='#00ffee';"); 这一行的第二个分号那边的this.style.backgroundcolor这里写成","了...

if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00ffee';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
}

如果你用的是gridview, 有时候要取消"自动套用格式"才能正常实现移动变色

下面是我在06年的时候写的一个,比较烂,希望能提供些许帮助

http://blog.csdn.net/rootbin1/archive/2006/10/22/1344825.aspx