专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »DotNet » 背景色:GridView中的行的背景色根据条件来显示不同的颜色 »正文

背景色:GridView中的行的背景色根据条件来显示不同的颜色

来源: 发布时间:星期三, 2008年9月10日 浏览:60次 评论:0
//以下代码必须写在GridView中的ItemDataBound事件中
if (e.Item.Cells[6].Text =="红色"
{
//当评分种类为不满意时背景色为红色
e.Item.Cells[6].Attributes.Add("style", "background-color:#FF9999");
}
else if (e.Item.Cells[6].Text == "绿色"
{
//当评分种类为没有评时背景色为绿色
//在此调用Color方法时必须引用命名空间using System.Drawing;
e.Item.BackColor = Color.Green;
}


//让Button背景色半透明的方法
btnSlect.BackColor = Color.Transparent; //使用Color必须引用命名空间using System.Drawing;

相关文章

读者评论

  • 共0条 分0页

发表评论

  • 昵称:
  • 内容: