Is there an event that is triggered after all Page_Load
events have completed?
How can i have more than one Page_Load
?
When you have user controls.
Before my page can render, i need my page (and all embedded controls) to have initialized themselves by completing their Page_Load
events.
The problem, of course, is that if i put code in my page's Page_Load
handler:
MyPage.aspx
--> Page_Load
---> DoSomethingWithUserControl()
UserControl1.ascx
--> Page_Load
---> initialize ourselves now that viewstate has been restored
then i begin to access my UserControl1
control before it is ready.
i need a way to run code after all Page_Load
events have fired, but before any postback events (e.g. Click events) have fired:
MyPage.aspx
--> Page_Load
UserControl1.ascx
--> Page_Load
---> initialize ourselves now that viewstate has been restored
MyPage.aspx
--> Page_AfterLoad
---> DoSomethingWithUserControl()
Looking at the page lifecycle in MSDN it looks like there is no way to raise an event after all Page_Loads have been completed:
Is there a way to raise an after after all Page_Loads have completed?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…