当前位置: 代码迷 >> Web前端 >> 改变gridview选中国人民银行的背景色
  详细解决方案

改变gridview选中国人民银行的背景色

热度:251   发布时间:2012-10-06 17:34:01.0
改变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");

?? ? ? ? ? ? ? ?//当鼠标离开时,还原背景色

?? ? ? ? ? ?}

?

?? ? ? ?}

  相关解决方案