//鼠标覆盖则变色该行
protected void dataTable_RowDataBound(object sender, GridViewRowEventArgs e){
if(e.Row.RowType == DataControlRowType.DataRow){
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor=‘#7a7b7d‘");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
//循环GridView每一行
var i=e.Row.RowIndex;
//循环找每一行的控件
e.Row.FindControl("控件ID")
时间: 2024-11-08 21:08:29