我有一个 aspx,里面有一个 ascx.通过简短的测试,我看到 aspx 的 PageLoad 在用户控件的 PageLoad 之前被调用,但 OnInit 的情况正好相反.
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)
谢谢
你应该看看这个ASP.NET 页面生命周期概述 和 这个
页面:预初始化控制:初始化页面:初始化页面:初始化完成页面:预加载页面:加载控制:加载页面:加载完成页面:预渲染控制:预渲染页面:PreRenderComplete页面:SaveStateComplete页面:渲染控制页面:渲染控制:渲染控制控制:卸载控制:处置页面:卸载页面:处理
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