//GridView控件的行数据绑定事件
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='#6699ff' "); //为当前行添加鼠标移出事件 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); } }