惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - Emmet.C

[求助]关于Vsiual Studio.NET 2005中Error List种错误的定位问题 【求助】关于asp.net中的'Thread was being aborted'异常 安装Tomcat 5.0.28备注 asp.net中如何回车触发指定按钮的事件 Jbuilder2005安装备注 使用Singleton改善ASP.NET性能备注 Infragistics.WebUI.UltraWebTab.v4.3使用备注 WinForm界面模式 如何定制WebCarlendar类型控件的星期格式 .NET在Debug模式下的编译错误 DataGrid动态绑定 Infragistics UltraWebTab的奇怪问题 架构设计备注(用户以及操作权限管理) 关于通过手机收发短信的相关资源 Read CPU ID(from CSDN) 可用性相关的资料站点 万网企业邮箱开始提供垃圾邮件过滤功能了 为何使用表格排版是不明智的? 申请了GMail
如何在运行时定制DataGrid的显示风格?
Emmet.C · 2005-03-01 · via 博客园 - Emmet.C

作为一个任务管理的界面,我们使用了一个DataGrid来显示任务列表。现在我们需要对显示风格作以下定制:
1。将任务状态为“已完成”的行以灰色(Gray)表示,并划上删除线。
2。将优先级别高的数据在主题前面加上红色的惊叹号图片(或者文字也可以,不过文字没有图片好看)
这样可以让用户明确的发现自己关注信息的重点。
此外我们在现有网页都使用了统一的CSS文件来控制式样。

我在databinding()之后使用了这样的代码来循环改变表格式样:
foreach(DataGridItem i in grdTasks.Items)
{
    if(i.Cells[0].Text="已完成")
    {
        i.Font.Strikeout = true;
        i.ForeColor = System.Drawing.Color.Gray;
    }
}

后来发现应该使用这种方法来加入界面表现代码
private void grdBulletins_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
    if(e.Item.Cells[0].Text == "已阅读")
    {
        e.Item.Attributes.Add("style","text-decoration: line-through; color: #808080");
    }  
}
刚开始的时候没有任何效果,后来才发现页面应用的CSS中所包含的TD式样优先级别比我所加入的Style级别要高(这也是我不明白的地方)。修改了一下CSS文件之后终于实现了第一个需求。

此外对于如何加图片至今没有任何头绪。:(
但是却没有任何效果,在网上也没有找到相关的资料。