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

推荐订阅源

IT之家
IT之家
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News and Events Feed by Topic
P
Privacy International News Feed
Apple Machine Learning Research
Apple Machine Learning Research
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
Spread Privacy
Spread Privacy
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
GbyAI
GbyAI
The Hacker News
The Hacker News
K
Kaspersky official blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Cyber Attacks, Cyber Crime and Cyber Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
A
About on SuperTechFans
S
Secure Thoughts
G
Google Developers Blog
博客园 - 司徒正美
Forbes - Security
Forbes - Security
T
The Exploit Database - CXSecurity.com
Latest news
Latest news
V2EX - 技术
V2EX - 技术
I
InfoQ
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Security Latest
Security Latest
AI
AI
T
Tailwind CSS Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cloudbric
Cloudbric
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Schneier on Security
博客园 - 【当耐特】
NISL@THU
NISL@THU
Y
Y Combinator Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
Lohrmann on Cybersecurity
Help Net Security
Help Net Security
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - leohuang

C#日期函数使用大全 replace(/\s/g,"")中的/g是什么意思? 及replace函数的用法 - leohuang - 博客园 Timestamp (rowversion) Data Type 为什么就没有中文版 数据库设计和优化 的书呢 巧用httpModules实现网站域名更换 asp.net 下发布水晶报表调试经验 C#操作Access的一些小结 Photoshop制作Favicon.ico图标(转载) 取消ie6自动打开excel - leohuang - 博客园 oracle多表查询分页 库存出入库算法 asp网站(asp+access)怎么防注入呢 Windows Service开发日志(转载csdn) IFrame 下返回登录页 访问母板页的updatepanel 及 设置 密码框字符 - leohuang 垃圾的江苏电信 amd 2500 boot设置 总算下到 Expert C# 2008 Business Objects 了 读《Expert C# 2005 Business Object》
Page_Load为什么会执行两次 - leohuang - 博客园
leohuang · 2009-09-23 · via 博客园 - leohuang

1,不输个字母数字,中文都打不进来。

今天调试程序,发现if (!Page.IsPostBack)里面的内容执行了两次,相不通。后来,找了很多资料,总算查出原因。
一方面,在aspx一开始中写了 AutoEventWireup="true" ,这样page_load会自动执行一次。
另一方面,生成的后台文件中有

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion

原来自动绑定了一次, 生成的代码又手工绑定了一次,所以要执行两次,去掉手工的部分,总算正常了, 原来,以前程序执行两次,我一直以为其它哪里写错了。