首页 > 代码库 > 循环GridView

循环GridView

//鼠标覆盖则变色该行
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")

循环GridView