ASP.NET Gridview特效(持续更新中...)

论坛 期权论坛 脚本     
匿名技术用户   2020-12-28 11:15   19   0

1、鼠标滑过时,行变色效果:

在Gridview的RowDataBound事件中加入以下代码:

//判定当前的行是否属于datarow类型的行
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标悬停在数据行上时,保存原来的行背景色并设置新的背景色
e.Row.Attributes.Add("onmouseover", "currentColor=this.style.backgroundColor;this.style.backgroundColor='green';");

//当鼠标移开后,将背景颜色恢复为原来的颜色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentColor;");
}

转载于:https://www.cnblogs.com/ruiyi1987/archive/2009/03/18/1415412.html

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP