In ASP.Net, during which page lifecycle event does

2019-01-30 19:39发布

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

6条回答
2楼-- · 2019-01-30 20:22

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.

查看更多
劳资没心,怎么记你
3楼-- · 2019-01-30 20:27

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

查看更多
地球回转人心会变
4楼-- · 2019-01-30 20:29

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

查看更多
走好不送
5楼-- · 2019-01-30 20:30

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

查看更多
我只想做你的唯一
6楼-- · 2019-01-30 20:33

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

查看更多
放我归山
7楼-- · 2019-01-30 20:34

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

查看更多
登录 后发表回答