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

推荐订阅源

S
SegmentFault 最新的问题
Spread Privacy
Spread Privacy
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
腾讯CDC
P
Privacy International News Feed
Webroot Blog
Webroot Blog
J
Java Code Geeks
爱范儿
爱范儿
A
About on SuperTechFans
S
Secure Thoughts
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Latest
Security Latest
Forbes - Security
Forbes - Security
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
量子位
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 聂微东
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs

博客园 - coollzh

关于.NET VS JavaEE平台争论的沉思录 不要使用Microsoft Project的理由 Using distributed transactions in .Net 1.x without deriving from ServicedComponent .NET下的开发者们正在继承计算机早期时代伟大的黑客精神 上海著名网络公司招聘高级软件工程师 即将过的2004 URLRewriting的问题 谁知道c++中的char ** 在C#中一般用什么类型 Indigo Untyped Channel VC#2005 最新技术预览版下周发布 上海某著名互联网公司招聘asp.net/.net开发工程师 Coming soon: “Enterprise Library” .net framework1.1到2.0的重大变化 Windows 2003 中DTC的怪事情 动态Validator的奇怪问题 sql server2000 在windows2003的默认安装客户端无法连接 msn”给你一个惊喜“的病毒 DataReader的问题 35岁前应该做好的十件事
一件及其汗的事!
coollzh · 2004-05-18 · via 博客园 - coollzh

最近在做报表,为了进行一些自定义得属性和操作,我从Repeater类派生出一个自定义得控件SDRepeater,override它的一些重要属性和方法,其中包括我改写了Repeater的数据源类型,改成了一个我自定义得数据类型,但该类并没有实现IEnumerable借口,
Ok,一且好像都搞定了,在页面中声明,填充数据,绑定控件,运行,于是发现一个非常奇怪的现象,控件中的纪录条数,页数,当前页和上下页按钮都在,就是不见数据表格。狂郁闷,从公司郁闷到家,
怎么出现这种事情呢?百思不得其解!
回到家后又经过近两个小时的代码审查,终于让我发现问题!其实是个非常初级C#多态的问题,可是我们平时在继承控件的时候就有可能犯类似错误
看看出错的代码:
public class SDRepeater: Repeater
{
  private RepeaterSource _dataSource;
  override public object DataSource
  {
   set
   {
     RepeatorSource source = value as RepeatorSource;
     _dataSource = source;
     ItemCount = source.ItemCount;
     CurrentPageIndex = source.PageIndex;
    
   }
   get{ return _dataSource;  /*this code result in bugs!!*/} 
  }
}
 public class RepeaterSource
 {
//using public field ...just for simply 
   public IList Source;
   public int ItemCount;
   public int PageIndex;
 }
你看出为什么有问题了吗?