搜索了一下,发现对于这种基本都使用girdview中的RowDataBound事件完成,下面看看网上提供的简单方法
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;");
}
}
asp.net(c#)GridView实现鼠标悬停高亮显示
最新推荐文章于 2023-08-10 09:35:07 发布
本文介绍了一种在ASP.NET中使用GridView控件时,通过RowDataBound事件改变行背景颜色的方法,实现当鼠标悬停在某一行时更改该行背景颜色的效果。

355

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



