protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
}
OnRowDataBound="GridView1_RowDataBound"dataGridView鼠标移至变色
最新推荐文章于 2026-06-21 18:08:12 发布
本文介绍了GridView控件中如何实现鼠标悬停时更改背景色的功能,包括使用onmouseover和onmouseout事件属性来动态改变背景颜色。

1385

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



