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

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

博客园 - sun@live

两段代码 <收藏>提高Web性能的14条法则(详细版) MOSS与业务系统的集成 之 单点登录 MOSS与业务系统的集成 之 自定义Membership实现Forms方式验证 手机归属地数据—采集 .Net数据源自定义参数 JavaScript和CSS速查手册 序列化一个字符串到CDATA元素(.NET 1.1) Sandcastle工具SandcastleBuilder 清除字符串数组中,重复元素 - sun@live - 博客园 Windows Live Writer 写的一个双向选择器(JS) 论坛中,用户权限解决方法 (原创)一个改自java的代码统计工具 Web2.0用户注册,激活,密码找回模块 [学习日志]EyasBlog控件部分已基本完成-2005-12-03 学习日志(Blog架构)-2005年11月09日 学习日志-2005年11月09日 学习计划-2005年11月07日
学习日志(blog日历控件)-2005年11月12日
sun@live · 2005-11-12 · via 博客园 - sun@live

今天又是周未了,继续我的blog,边学边Coding吧!
定下的任务是完成日历控件的编码,在网上也找了几篇文章,
http://www.guoblog.com/blogview.asp?logID=79

代码量比较大,看上去效率不高筛选
查了下MSDN,发现一个好办法 
首先从数据库读取某一个月的日历数据,在DayRender事件里在显示每一页时利用DataView的筛选功能,对一个月的日历进行筛选,如果筛选后的行数大于0,说明当天有日志,加入链接。
部分代码如下:

protected override void OnDayRender(TableCell cell, CalendarDay day)
        
{         
            
if (_dtSource != null
            
{
                DataView dv 
= new DataView(_dtSource);
                     //进行筛选
                dv.RowFilter 
= string.Format(
                    
"{0} >= #{1}# and {0} < #{2}#"
                    
this.DayField, 
                    day.Date.ToString(
"MM-dd-yyyy"), 
                    day.Date.AddDays(
1).ToString("MM-dd-yyyy")
                    );
                                
                
if (dv.Count > 0
                
{
                    cell.Controls.Clear();
                    cell.Controls.Add(
new LiteralControl(string.Format("<a href=?Date={0}>{1}</a>",day.Date.ToString(),day.Date.Day)));
                }
            }
        }