Question

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

Was it helpful?

Solution

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

OTHER TIPS

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. enter image description here

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

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.

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top