In ASP.Net, during which page lifecycle event does viewstate get loaded?

允我心安 提交于 2019-11-28 16:20:07

问题


I know it happens sometime before Load, but during what event exactly?


回答1:


It's loaded into memory between init and load. See this article for a full break down of the page lifecycle.




回答2:


I once got into this question too and got my answer from TRULY understanding Viewstate article, which I highly recommend.

After reading it I designed a graphic that helped me to understand better what was happening on between each stage and when and how ViewState was doing its job.

I'd like to share this graphic with other people that (like myself) need to see how stuff work in a more visual way. Hope it helps! :)

Click on the image to view at full width.




回答3:


That is to say, viewstate is loaded between the OnInit() and OnLoad() events of the page.

My favorite article on dealing with viewstate, which answers every question I have every time: http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx




回答4:


You can see from the page life cycle as explained on MSDN

That the view state is loaded during the Load phase of the page lifecycle, i.e. the LoadViewState method of the "Page methods" and the LoadViewState method of the Control methods, above.




回答5:


The Viewstate is actually loaded in the OnPreLoad event of the page,Just after the Page_InitComplete.




回答6:


The viewstate is actually loaded between initComplete and Preload events.Check this for details http://msdn.microsoft.com/en-us/library/ms178472.aspx



来源:https://stackoverflow.com/questions/94696/in-asp-net-during-which-page-lifecycle-event-does-viewstate-get-loaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!