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

推荐订阅源

F
Fortinet All Blogs
WordPress大学
WordPress大学
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
博客园 - Franky
D
Docker
小众软件
小众软件
阮一峰的网络日志
阮一峰的网络日志
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
U
Unit 42
M
MIT News - Artificial intelligence
B
Blog
GbyAI
GbyAI
C
Check Point Blog
P
Proofpoint News Feed
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
IT之家
IT之家
Google DeepMind News
Google DeepMind News
V
V2EX
Stack Overflow Blog
Stack Overflow Blog

博客园 - 龚振

T4 模板编辑。 MVC 表单验证的几种方式: Login failed for user 'IIS APPPOOL\ASP.NET v4.0'. - 龚振 Keycode对照表 使用多字节字符集 syslink 不显示 Windows下JSP开发环境的配置 javascript 大括号,圆括号 清空数据库日志 数据库还原错误 (with move) 打开visual studio 智能感知(intellisense) for Unity Application Blocks (翻译) firefox ie DOM 级兼容性(一) ie ,firefox 兼容性,收集。。。。。 IE6.0、IE7.0 与 FireFox 收集,总是忘,还是收集了,以后总结下 web 版 ftp 数据库迁移可能遇到的问题 将物理内存制作为虚拟硬盘,提高系统速度 NET设计模式总结 关于Web服务器时间格式问题 关于Gridview templateField 无法 sort
自定义控件状态保存
龚振 · 2008-06-12 · via 博客园 - 龚振

自定义控件状态保存

Posted on 2008-06-12 13:51  龚振  阅读(263)  评论(0)    收藏  举报

protected void Page_Load(object sender, EventArgs e)
  {
  CheckBoxList chk = new CheckBoxList();
  form1.Controls.Add(chk);
  if (!IsPostBack)
  {
  chk.Items.Add("Hello");
  }
  }
  或者:
  protected void Page_Load(object sender, EventArgs e)
  {
  CheckBoxList chk = new CheckBoxList();
  (chk.Items as IStateManager).TrackViewState();
  if (!IsPostBack)
  {
  chk.Items.Add("Hello");
  }
  form1.Controls.Add(chk);
  }