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

推荐订阅源

大猫的无限游戏
大猫的无限游戏
Webroot Blog
Webroot Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Threat Research - Cisco Blogs
V2EX - 技术
V2EX - 技术
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
Recorded Future
Recorded Future
S
Schneier on Security
I
InfoQ
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The GitHub Blog
The GitHub Blog
S
Security @ Cisco Blogs
O
OpenAI News
W
WeLiveSecurity
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
人人都是产品经理
人人都是产品经理
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
The Hacker News
The Hacker News
Google Online Security Blog
Google Online Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
NISL@THU
NISL@THU
T
Tailwind CSS Blog
V
Visual Studio Blog
PCI Perspectives
PCI Perspectives
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
D
DataBreaches.Net
B
Blog RSS Feed
N
News and Events Feed by Topic
N
News and Events Feed by Topic
H
Heimdal Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
腾讯CDC
Latest news
Latest news
V
Vulnerabilities – Threatpost
Hacker News: Ask HN
Hacker News: Ask HN
WordPress大学
WordPress大学
V
V2EX
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Register - Security
The Register - Security
Help Net Security
Help Net Security

博客园 - andy.wu

聊聊除了生产率之外的东西,比如赚钱效率 一次思维锻炼,使用拼音模糊匹配中文 - andy.wu - 博客园 一些需要解决的问题(Win32) svn howto: svn合并时报错:retrieval of mergeinfo unsupported by 。 Windows Mobile应用开发(1):使用Win32 SDK 开发屏幕手电程序 vs(2005 and 2008)中使用vc++创建智能设备项目失败的正确解决方案 思考:google的opensocial的实现原理 思考:日期类型的数据应该用什么样的具体形式存储到数据库? google got crazy!!! NHibernate Tips: 要注意模型与数据库在Null方面的匹配 AjaxPro基础知识 and FAQ 在iis 6中使用共享目录作为虚拟目录 初学wpf感想 Sql Server 2005全文检索中碰到的问题和分析 asp.net faq: 在html文件中,用js获取session? 给博客园首页管理的建议 china-pub,当当,卓越购书经验谈 使用Emacs代替Windows下的Command shell 经验:使用.net 2.0中的TransactionScope碰到的问题
EnableViewState详细分析 - andy.wu - 博客园
andy.wu · 2008-12-01 · via 博客园 - andy.wu

ASP.NET中,很多地方可以设置EnableViewState,本文主要说明一下在不同位置设置EnableViewState的效果。

1. 在web.config中

在page小节中设置,比如:

<pages enableViewState="false">
 这样的设置后,所有没有明确指定EnableViewState的控件,都会使用在web.config中指定的值。

2. 在MasterPage中

当在MasterPage中EnableViewState=false时,表示禁用了使用该MasterPage的页面的视图状态信息,包括所有控件,即使页面或控件明确指定EnableViewState=true。

3. 在Page中

当在Page中EnableViewState=false时,表示禁用了该Page的页面的视图状态信息,包括所有控件,即使控件明确指定EnableViewState=true。

4. 在UserControl中

当在UserControl中EnableViewState=false时,表示禁用了该UserControl的视图状态信息,包括所有控件,即使控件明确指定EnableViewState=true。

5. 在控件中

当在控件中EnableViewState=false时,表示禁用了该控件的视图状态信息。

注:如果要确保某个控件使用视图状态,可以在该控件的OnInit事件中,指定该控件的父控件和Page使用视图状态。

我通常的做法:

在web.config中禁用视图状态,当需要启用时再明确指定。