zoukankan      html  css  js  c++  java
  • VS2005 gridview 控件 row 鼠标悬停变色

    1.拖一个gridview控件,添加RowCreated事件代码,如下:

    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {  
             e.Row.Attributes.Add("onmouseover", "bgColor='LightCyan'");
             e.Row.Attributes.Add("onmouseout", "bgColor=''");    
        }

    2.以上代码变色时连header也随着一起变色,如果只希望datarow变色,加上一个判断即可.

    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            
         if (e.Row.RowType == DataControlRowType.DataRow)
    //判断是不是datarow,将header去掉
            {
            e.Row.Attributes.Add("onmouseover", "bgColor='LightCyan'");
            e.Row.Attributes.Add("onmouseout", "bgColor=''");     
           }
        }

  • 相关阅读:
    HDU5120
    POJ 1062
    POJ 1086
    BestCoder 1st Anniversary (HDU 5311)
    HDU 5284
    Dylans loves sequence(hdu5273)
    day65 作业
    第三次小组分享 猴子补丁
    day59 csrf auth
    day58 cookie session 中间件
  • 原文地址:https://www.cnblogs.com/zjw/p/1233578.html
Copyright © 2011-2022 走看看