代码
1
protected
void
GridView1_RowDataBound(
object
sender, GridViewRowEventArgs e)
2 {
3
4 // 如果是绑定数据行
5
6 if (e.Row.RowType == DataControlRowType.DataRow)
7 {
8
9 // 鼠标经过时,行背景色变
10 e.Row.Attributes.Add( " onmouseover " ,
11 " currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff' " );
12
13 // 鼠标移出时,行背景色变
14 e.Row.Attributes.Add( " onmouseout " , " this.style.backgroundColor=currentcolor " );
15 }
16
17 }
18
19
2 {
3
4 // 如果是绑定数据行
5
6 if (e.Row.RowType == DataControlRowType.DataRow)
7 {
8
9 // 鼠标经过时,行背景色变
10 e.Row.Attributes.Add( " onmouseover " ,
11 " currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff' " );
12
13 // 鼠标移出时,行背景色变
14 e.Row.Attributes.Add( " onmouseout " , " this.style.backgroundColor=currentcolor " );
15 }
16
17 }
18
19