ASP.NET 页面创建的事件序列
我正在寻找一篇很好的教程/文章来解释创建页面时发生的事件的确切顺序。我永远记不起顺序。我认为这就像父控件 Init 事件被调用,然后子控件 Init 事件被调用,按照页面上的放置顺序。另外,当调用控制事件时,它们是按什么顺序调用的?例如,如果引发按钮事件,如果 DataList.DataBind 位于 Page_Load 事件中,是否会在调用 DataList_ItemDataBound 事件之前调用此事件?那么,是否有人想尝试解释或引导我阅读一篇解释这一切的好文章?
谢谢。
I'm looking for a good tutorial/article that explains the exact sequence of events that takes place when a page is created. I can never remember the order. I think it's something like the parent controls Init event is called, then the child controls Init event is called, in order of the placement on the page. Also, when the control events are called, what order are they called in? For example, if a button event is raised, does this event get called before a DataList_ItemDataBound event is called if the DataList.DataBind is in the Page_Load event? So, does anyone want to try to explain or direct me to a nice article that explains all this?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个链接应该涵盖它:
MSDN 页面生命周期
This link should cover it:
MSDN Page Life Cycle
也许您正在寻找这个:
作者:Leon Andrianarivony。
Maybe you're looking for this:
by Leon Andrianarivony.
对于此类问题,我参考了一篇很好的文章。
http://www .aspfree.com/c/a/ASP.NET/ASP.NET-Life-Cycle-and-Best-Practices/
并具体回答您的问题 - 按钮事件在页面加载中的所有内容完成后运行,因此如果您在 Page_Load 中调用 DataBind,按钮单击事件随后发生。
This is a good article I refer to for these types of questions.
http://www.aspfree.com/c/a/ASP.NET/ASP.NET-Life-Cycle-and-Best-Practices/
And to answer your question specifically - Button events run after everything in Page Load is completed so if you're calling a DataBind in Page_Load, the button click event comes after that.