zoukankan      html  css  js  c++  java
  • Gridview中奇偶数行颜色设置

    在gridview中的RowDataBound事件里面写

    switch (e.Row.RowType)
    {
    case DataControlRowType.Header:
     e.Row.BackColor = Color.FromArgb(153, 0, 0);
     e.Row.ForeColor = Color.White;
     break;
    case DataControlRowType.DataRow:
    //建立奇数行与偶数行的onmouseover及onmouseout的颜色变换
    if (Convert.ToInt16(ViewState["LineNo"]) == 0)
    {
    e.Row.BackColor = Color.FromArgb(255, 251, 214);
    //e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFBD6';this.style.color='black'");
    //e.Row.Attributes.Add("onckick", "this.style.backgroundColor='#C0C0FF';this.style.color='#ffffff'");

    ViewState["LineNo"] = 1;
    }
    else
    {
    e.Row.BackColor = Color.White;
    //e.Row.Attributes.Add("onckick", "this.style.backgroundColor='#FFFFFF';this.style.color='black'");
    //e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#C0C0FF';this.style.color='#ffffff'");

    ViewState["LineNo"] = 0;
    }

    break;
    }

  • 相关阅读:
    Android Monkey压测命令
    测试常用__linux命令
    适合做自动化的项目
    windows安装MySQL8.0
    视频丢帧(详解)
    selenium 鼠标,键盘操作
    定位元素方法
    关于Python中的lambda
    项目流程
    正则表达式之扩展正则表达式
  • 原文地址:https://www.cnblogs.com/ahao214/p/4070229.html
Copyright © 2011-2022 走看看