在GridView控件的RowDataBound事件中添加以下代码:

protected void gvOperateLog_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add(
"onmouseover", "currentColor=this.style.backgroundColor;this.style.backgroundColor='#eef2fb'");
e.Row.Attributes.Add(
"onmouseout", "this.style.backgroundColor=currentColor");
}
}

相关文章: