/// <summary>
/// 在GridView中添加鼠标经过时,行背景色改变;鼠标移出时,行背景色还原的属性.
/// </summary>
/// <param name="e">GridViewRowEventArgs类型</param>
/// <param name="color">需要改变的颜色,例如:"#c5bbaf"</param>
public static void GvAddMouseOverClick(GridViewRowEventArgs e,string color)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标经过时,行背景色变
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='"+color+"';this.style.cursor='hand';");
//鼠标移出时,行背景色还原
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
}
protected void gvInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
commonDemo.GvAddMouseOverClick(e, "#c0c0ff");
}