0
点赞
收藏
分享

微信扫一扫

鼠标指向 gridview 某行,某行颜色加亮

小禹说财 2023-02-19 阅读 70


 

在RowDataBound事件里写

Dim i As Int32        For i = 0 To GridView1.Rows.Count
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'")
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c")
End If
Next

当然,也可更简单些:

If e.Row.RowType = DataControlRowType.DataRow Then            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA'")
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'")
End If


举报

相关推荐

0 条评论