开发者

Why does some page components not getting fully loaded in Page_Init of ASP.NET?

开发者 https://www.devze.com 2023-01-05 14:41 出处:网络
In page-init, view state and some other components don\'t get loaded. Which are they? Why do they loaded in Page-Load only? What does the need of P开发者_运维技巧age-Init then ?Page_Init:

In page-init, view state and some other components don't get loaded. Which are they?

Why do they loaded in Page-Load only? What does the need of P开发者_运维技巧age-Init then ?


Page_Init: Fired when page is initialised. This includes postbacks. All server controls are created to their initial, unaltered state. First step in page lifecycle, controls are organized hierarchically.

Page_Load: Controls fully loaded, if the page is a postback, then the controls are loaded with their viewstate.

In other words, Viewstate only comes into effect on Page_Load, where (if Viewstate is enabled for the control/page), the controls previous state is reloaded.

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消