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

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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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

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

Method 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

Method 4

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

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

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.

Method 5

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

Method 6

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x