zoukankan      html  css  js  c++  java
  • 设置datagrid的背影及对单元格进行设置

       //如果是数据项并且是交替项
       if(e.Item.ItemType == ListItemType.Item  || e.Item.ItemType == ListItemType.AlternatingItem)
       {
        //添加自定义属性,当鼠标移过来时设置该行的背景色为"6699ff",并保存原背景色
        e.Item.Attributes.Add("onmouseover","currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
        //添加自定义属性,当鼠标移走时还原该行的背景色
        e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=currentcolor");

       }
       //如果当前项不为空
       if(e.Item.ItemIndex != -1 )
       {
        //取得当前项的索引值加1,因为项的索引值是从0开始的.
        int orderID = e.Item.ItemIndex+1;
        //设置第一列为的单元格内容为当前项索引值加1
        e.Item.Cells[0].Text = orderID.ToString();

        //如果库存为零,则设置该行的背景色为蓝色
        if((e.Item.Cells[8].Text)=="0.00")
         e.Item.Cells[8].CssClass="ItemStyleRightBoldRed";
       }

  • 相关阅读:
    pandas模块
    27.mysql数据库之约束
    nump模块
    26.mysql数据库基础
    24.IO模型
    23.并发编程之协程
    第五十三篇 并发编程之多进程续
    第五十二篇 操作系统简史——多道技术
    第五十一篇 并发编程——多进程
    第四十九篇 socket套接字编程
  • 原文地址:https://www.cnblogs.com/hhq80/p/657399.html
Copyright © 2011-2022 走看看