GridView光棒效果

  当鼠标放在gridview上某一行时,颜色改变,离开时颜色回复,原来这种效果就叫光棒效果 - -

  我们可以在girdview的数据绑定后事件上通过js代码去实现它:

1 protected void gvMain_RowDataBound(object sender, GridViewRowEventArgs e)
2 {
3 if (e.Row.RowType == DataControlRowType.DataRow)
4 {
5 e.Row.Attributes.Add("onmouseover",
6 "oldColor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
7 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=oldColor");
8 }
9 }

 

posted @ 2010-10-25 23:41  aShu123  阅读(340)  评论(1编辑  收藏  举报