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");
}
}