1
protected
void
GridView1_RowCreated(
object
sender, GridViewRowEventArgs e)
2
{
3
if
(e.Row.RowType
==
DataControlRowType.DataRow )
4
{
5
e.Row.Attributes.Add(
"
onmouseover
"
,
"
currentcolor=this.style.backgroundColor;this.style.backgroundColor='#C0C0FF';this.style.cursor='hand';
"
);
6
//
当鼠标移走时还原该行的背景色
7
e.Row.Attributes.Add(
"
onmouseout
"
,
"
this.style.backgroundColor=currentcolor
"
);
8
}
9
}
其中currentcolor=this.style.backgroundColor;最为重要!!!