Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 page-init 中,视图状态和其他一些组件不会被加载。他们是谁?
为什么它们只在页面加载中加载?那么Page-Init需要什么?
Page_Init:页面初始化时触发。这包括回发。所有服务器控件都创建为其初始的、未更改的状态。页面生命周期的第一步,控件是分层组织的。
Page_Load:控件完全加载,如果页面是回发,则控件将加载其视图状态。
换句话说,Viewstate仅在 Page_Load 上生效,其中(如果为控件/页面启用了 Viewstate),则重新加载控件的先前状态。
希望有帮助。