导航

生命周期 Pag Life Cycle

Posted on 2007-10-24 22:02  Heclei  阅读(339)  评论(0编辑  收藏  举报
注:刚从硬盘里发现的,忘了从哪里整理出来的。有知道的兄弟帮忙添加个引用。
本文向烈推荐给所以想要或正在进行Web开发的朋友们,只有了解了页面执行的过程,才能使你的设计开发更上一步,如鱼得水。同时也建议关注一下IIS管道及ASP.NET管道(HttpModule, HttpHandle等)。

 

Pag Life Cycle

PreInit

l         All controls created and initialized with default value.

l         Occurs: only for page class. UserControls, MasterPages do not have the method to override.

Note:

1.         PreInit() is the only event set Themes programmatically.

2.         Controls initialized after Init().

OnInit

l         Can read properties set at design time.

Note:

1.         After LoadPostData(), we can access the values changed by user.

LoadViewState

l         Fired if the page has posted back (IsPostBack == true)

LoadPostBackData

l         Fired if the page has posted back.

l         In this event, the controls which implement IpostBackDataHandle interface gets loaded by the values from Http Post Data.

Note:

1.         Http PostData has only a value pre control.

Page_Load

U know most

Control Event Handles

l         Like button click event

Note:

1.         Page_Load will fire first before any event handle.

PreRender

l         Recursively fire for each child controls in this page.

Note:

1.         Last event we can make any changes to control values.

SaveViewState

l         ViewState of the controls got saved in the form’s hidden control.

Render

l         All control are rendered recursively.

Unload

l         Perform clear up operations.

Additional

1.         ProcessPostData

l         Cause the viewstate to catch up

~~~~~~~~~~J