asp.net: what's the page life cycle order of a control/page compared to a user contorl inside it?

守給你的承諾、 提交于 2019-11-27 09:12:55

问题


I have an aspx and inside it an ascx. From a short testing I see the PageLoad of the aspx is called before the PageLoad of the user-Control but the opposite is true for OnInit.

Does someone know what is the order of the events (page compared to a user-control inside it)

Thanks


回答1:


You should look at this ASP.NET Page Life Cycle Overview and this

Page: PreInit
Control: Init
Page: Init
Page: InitComplete
Page: PreLoad
Page: Load
Control: Load
Page: LoadComplete
Page: PreRender
Control: PreRender
Page: PreRenderComplete
Page: SaveStateComplete
Page: RenderControl
Page: Render
Control: RenderControl
Control: Unload
Control: Dispose
Page: Unload
Page: Dispose




回答2:


below link has more information

http://weblogs.asp.net/ricardoperes/archive/2009/03/08/asp-net-page-events-lifecycle.aspx



来源:https://stackoverflow.com/questions/7335142/asp-net-whats-the-page-life-cycle-order-of-a-control-page-compared-to-a-user-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!