Reputation: 4933
This seems to be very primary question, but I met lot of difficulties while implementing my program.
My program Structure is as follows:
I have 2 content page called News.aspx and Contact.aspx. these two pages contain user controls as well.
I have code for PreInit
and Load
in both .aspx page and user control contain Init
method.
If user is currently in contact.aspx page and then he click on the link button to move to News.aspx page, what is the order of firing those events?
When i put break point and check then it comes in following order.
Contact.aspx PreInit
Contact.aspx Init
News.aspx PreInit
News.aspx Init
but even though sometimes this works other way around. first News.aspx methods then abc.aspx page method.
What is the exact order? In addition to that using java script i called web method every page refresh in onbeforeunload. in the above scenario that method call as follows:
Contact.aspx PreInit
Contact.aspx Init
Web Method () on Page Refresh
News.aspx PreInit
News.aspx Init
What is the correct order of calling these methods?
Upvotes: 0
Views: 1318
Reputation: 14971
This is the order of the life cycle events:
The Page's PreInit event is triggered before the controls are initialized, so the user control does not have a PreInit event. Please see http://msdn.microsoft.com/en-us/library/ms178472.aspx.
Upvotes: 1