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

后端 未结 6 2151
甜味超标
甜味超标 2020-12-23 10:26

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

相关标签:
6条回答
  • 2020-12-23 10:48

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

    0 讨论(0)
  • 2020-12-23 10:48

    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.

    0 讨论(0)
  • 2020-12-23 10:57

    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

    0 讨论(0)
  • 2020-12-23 11:01

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

    0 讨论(0)
  • 2020-12-23 11:06

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

    0 讨论(0)
  • 2020-12-23 11:08

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

    enter image description here

    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.

    0 讨论(0)
提交回复
热议问题