GridView控件添加鼠标移入移出时背景行变色的效果

在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");
}
}
posted @ 2011-06-27 14:39  亿典通柄棋  阅读(456)  评论(0编辑  收藏  举报