protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//如果是绑定数据行
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标移入时,行背景色变
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ff9900'");
//鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#ffffff'");
}
}
{
//如果是绑定数据行
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标移入时,行背景色变
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ff9900'");
//鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#ffffff'");
}
}