首先为GridView添加RowDataBound事件
在事件里面写入如下代码:
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#F0FAFF'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");
}
本博客介绍如何在GridView中使用RowDataBound事件,通过JavaScript实现鼠标悬停时行背景色变化的效果,增强用户体验。
569

被折叠的 条评论
为什么被折叠?



