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

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

博客园 - laughterwym

edwin-wang.com GridView vs DataGrid 来句老套的~~~Happy 牛 Year !!! Autopostback提示“该对象不支持此属性或方法”(Object doesn't support this property or method) Grub vga模式 个人常用软件替代列表,支持开源 One more time, One more chance 获得Access数据表名列表 初面纪念 关于Windows 2003 ".." 表示父路径解决方法 Windows 2003 SD读卡器驱动方法 关于水晶报表分页统计的开发经验 残败的考试 一段时间的忙碌…… Standards: big benefits for small business 国庆、中秋快乐!!! 2 weeks later 2周,开始忙碌中适应这里的生活了……累 I Do Believe
GridView mouseover的高亮
laughterwym · 2009-05-13 · via 博客园 - laughterwym

由于dotnet中获得到的RowStyle中color为System.Drawing.Color类的,所以首先需要将其转换成HTML能够接受的#xxxxxx形式。写了一个函数:

 1string toWebColor(System.Drawing.Color theColor)
 2{
 3if (Convert.ToString(theColor.R, 16== "0" && Convert.ToString(theColor.G, 16== "0" && Convert.ToString(theColor.B, 16== "0")
 4{
 5return "#ffffff";
 6}

 7else
 8{
 9return "#" + Convert.ToString(theColor.R, 16+ Convert.ToString(theColor.G, 16+ Convert.ToString(theColor.B, 16);
10}

11}

下边的程序就是个间隔行设置Attribute的行为:

 1if (e.Row.RowType == DataControlRowType.DataRow)
 2{
 3if (e.Row.RowState == DataControlRowState.Normal)
 4{
 5e.Row.Attributes.Add("onmouseover""this.style.backgroundColor='orange'");
 6e.Row.Attributes.Add("onmouseout""this.style.backgroundColor='" + toWebColor(GridView.RowStyle.BackColor) + "'");
 7}

 8else if (e.Row.RowState == DataControlRowState.Alternate)
 9{
10e.Row.Attributes.Add("onmouseover""this.style.backgroundColor='orange'");
11e.Row.Attributes.Add("onmouseout""this.style.backgroundColor='" + toWebColor(GridView.AlternatingRowStyle.BackColor) + "'");
12}

13else
14return;
15}