在GridView中鼠标移动到行该行颜色变换


 1.在GridView中 鼠标移动到行 该行颜色变换

  步骤1.为GridView添加RowCreated的事件。事件代码如下:

  protected void gv_typelist_RowCreated(object sender, GridViewRowEventArgs e)
  {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
    e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#99cc00'");
      e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
    }
  }

  鼠标移动到行的效果:

  鼠标移开的效果:


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3