改变gridview选中行的背景色
?protected void gridView_OnRowCreated(object sender, GridViewRowEventArgs e)
?? ? ? ?{
?
?? ? ? ? ? ?if (e.Row.RowType == DataControlRowType.DataRow)
?? ? ? ? ? ?{
?? ? ? ? ? ? ? ?e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor; this.style.backgroundColor='#CCCCCC'");
?? ? ? ? ? ? ? ?//变量c用与存储鼠标移动在行上时,原来的背景色,然后设置为'#CCCCCC'
?? ? ? ? ? ? ? ?e.Row.Attributes.Add("onmouseout", " this.style.backgroundColor=c");
?? ? ? ? ? ? ? ?//当鼠标离开时,还原背景色
?? ? ? ? ? ?}
?
?? ? ? ?}