Why does some page components not getting fully loaded in Page_Init of ASP.NET?
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.
精彩评论