protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='ivory'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
}
}
本文介绍如何使用 ASP.NET 中的 GridView 控件为数据行添加鼠标悬停时背景颜色变化的效果,通过简单地在 RowDataBound 事件中加入 JavaScript 代码实现这一功能。
3874

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



